Changeset 1338 for trunk


Ignore:
Timestamp:
09/14/11 10:02:16 (21 months ago)
Author:
philmoz
Message:

Changes to core CHDK required to support IXUS310 (Elph500HS) & touch screen U/I.

Location:
trunk
Files:
23 edited

Legend:

Unmodified
Added
Removed
  • trunk/CHDK/LANG/english.lng

    r1317 r1338  
    598598460 "You need to be in REC-mode\nfor this operation." 
    599599461 "%s disabled in build" 
     600462 "Touchscreen overrides" 
     601463 "Video AE Controls" 
     602464 "<Alt> Shortcut Buttons" 
  • trunk/core/conf.c

    r1245 r1338  
    402402        CONF_INFO(242, conf.edge_overlay_show,     CONF_DEF_VALUE, i:0, NULL), 
    403403    CONF_INFO(243, conf.edge_overlay_pano_overlap,   CONF_DEF_VALUE, i:30, NULL), 
     404 
     405    // Touch screen U/I overrides 
     406    CONF_INFO(244, conf.touchscreen_disable_video_controls, CONF_DEF_VALUE, i:0, NULL), 
     407    CONF_INFO(245, conf.touchscreen_disable_shortcut_controls, CONF_DEF_VALUE, i:0, NULL), 
    404408    }; 
    405409#define CONF_NUM (sizeof(conf_info)/sizeof(conf_info[0])) 
  • trunk/core/gui.c

    r1337 r1338  
    204204        static void gui_load_curve(int arg); 
    205205#endif 
    206 static const char* gui_histo_show_enum(int change, int arg); 
     206      const char* gui_histo_show_enum(int change, int arg); 
    207207static const char* gui_histo_mode_enum(int change, int arg); 
    208208static const char* gui_temp_mode_enum(int change, int arg); 
     
    254254static const char* gui_iso_exposure_order_enum(int change, int arg); 
    255255*/ 
    256 static const char* gui_nd_filter_state_enum(int change, int arg); 
     256      const char* gui_nd_filter_state_enum(int change, int arg); 
    257257//static const char* gui_tv_enum(int change, int arg); 
    258258const char* gui_user_menu_show_enum(int change, int arg); 
     
    269269static const char* gui_video_af_key_enum(int change, int arg); 
    270270static const char* gui_show_movie_time(int change, int arg); 
    271 static const char* gui_override_disable_enum(int change, int arg); 
     271      const char* gui_override_disable_enum(int change, int arg); 
    272272#ifdef OPT_CURVES 
    273273        static const char* gui_conf_curve_enum(int change, int arg); 
     
    767767static CMenu raw_state_submenu = {0x24,LANG_MENU_OSD_RAW_STATE_PARAMS_TITLE, NULL, raw_state_submenu_items }; 
    768768 
     769#ifdef  CAM_TOUCHSCREEN_UI 
     770static const char* gui_touchscreen_disable_video_enum(int change, int arg); 
     771static const char* gui_touchscreen_disable_shortcuts_enum(int change, int arg); 
     772static CMenuItem touchscreen_submenu_items[] = { 
     773    {0x5f,LANG_MENU_TS_VIDEO_AE_DISABLE,     MENUITEM_ENUM,    (int*)gui_touchscreen_disable_video_enum }, 
     774    {0x5f,LANG_MENU_TS_ALT_SHORTCUTS_DISABLE,MENUITEM_ENUM,    (int*)gui_touchscreen_disable_shortcuts_enum }, 
     775    {0x51,LANG_MENU_BACK,                    MENUITEM_UP }, 
     776    {0} 
     777}; 
     778static CMenu touchscreen_submenu = {0x28,LANG_MENU_TOUCHSCREEN_VALUES, /*cb_values_menu_change*/ NULL, touchscreen_submenu_items }; 
     779#endif 
    769780 
    770781static CMenuItem osd_submenu_items[] = { 
     
    792803    {0x5c,LANG_MENU_MAIN_SAVE_OPTIONS,       MENUITEM_PROC,      (int*)gui_menuproc_save }, 
    793804#endif 
     805#ifdef  CAM_TOUCHSCREEN_UI 
     806    {0x22,LANG_MENU_TOUCHSCREEN_VALUES,          MENUITEM_SUBMENU,   (int*)&touchscreen_submenu }, 
     807#endif 
    794808    {0x51,LANG_MENU_BACK,                    MENUITEM_UP }, 
    795809    {0} 
     
    12331247        return gui_change_simple_enum(&conf.sub_batch_ext,change,img_exts,NUM_IMG_EXTS); 
    12341248} 
     1249 
     1250//------------------------------------------------------------------- 
     1251#ifdef  CAM_TOUCHSCREEN_UI 
     1252 
     1253const char* gui_on_off_enum(int change, int *conf_val) 
     1254{ 
     1255    static const char* modes[]={ "Off", "On"}; 
     1256        return gui_change_simple_enum(conf_val,change,modes,sizeof(modes)/sizeof(modes[0])); 
     1257} 
     1258 
     1259const char* gui_touchscreen_disable_video_enum(int change, int arg) { 
     1260    static const char* modes[]={ "Enable", "Disable" }; 
     1261        return gui_change_simple_enum(&conf.touchscreen_disable_video_controls,change,modes,sizeof(modes)/sizeof(modes[0])); 
     1262} 
     1263 
     1264const char* gui_touchscreen_disable_shortcuts_enum(int change, int arg) { 
     1265    static const char* modes[]={ "Enable", "Disable" }; 
     1266        return gui_change_simple_enum(&conf.touchscreen_disable_shortcut_controls,change,modes,sizeof(modes)/sizeof(modes[0])); 
     1267} 
     1268 
     1269#endif 
    12351270 
    12361271//------------------------------------------------------------------- 
     
    18191854void gui_init() 
    18201855{ 
    1821  
    1822     gui_mode = GUI_MODE_NONE; 
     1856    gui_set_mode(GUI_MODE_NONE); 
    18231857    gui_restore = 0; 
    18241858    gui_in_redraw = 0; 
     
    18811915//------------------------------------------------------------------- 
    18821916void gui_set_mode(enum Gui_Mode mode) { 
     1917#ifdef CAM_TOUCHSCREEN_UI 
     1918    if (((gui_mode == 0) != (mode == 0)) ||                         // Change from GUI_MODE_NONE to any other or vice-versa 
     1919        ((gui_mode > GUI_MODE_MENU) != (mode > GUI_MODE_MENU)))     // Switch in & out of menu mode 
     1920        redraw_buttons = 1; 
     1921#endif 
    18831922    gui_mode = mode; 
    18841923} 
     
    19301969 
    19311970//------------------------------------------------------------------- 
     1971#ifdef OPTIONS_AUTOSAVE 
     1972 
     1973static void conf_store_old_settings() { 
     1974    old_conf=conf; 
     1975} 
     1976 
     1977static int conf_save_new_settings_if_changed() { 
     1978    if (memcmp(&old_conf, &conf, sizeof(Conf)) != 0) { 
     1979                user_menu_save(); 
     1980        conf_save(); 
     1981        conf_store_old_settings(); 
     1982        return 1; 
     1983    } 
     1984    return 0; 
     1985} 
     1986 
     1987#endif 
     1988 
     1989//------------------------------------------------------------------- 
     1990void gui_chdk_draw() 
     1991{ 
     1992    static int show_md_grid=0; 
     1993 
     1994    gui_draw_osd(); 
     1995 
     1996#ifdef CAM_DISP_ALT_TEXT 
     1997    draw_txt_string(20, 14, "<ALT>", MAKE_COLOR(COLOR_ALT_BG, COLOR_FG)); 
     1998#endif 
     1999 
     2000#ifdef OPT_SCRIPTING 
     2001    if ((mode_get()&MODE_MASK) == MODE_REC) 
     2002    { 
     2003        draw_txt_string(0, 14, script_title, MAKE_COLOR(COLOR_ALT_BG, COLOR_FG)); 
     2004        if (state_kbd_script_run) show_md_grid=5; 
     2005        if (show_md_grid) 
     2006        { 
     2007            --show_md_grid; 
     2008            md_draw_grid(); 
     2009        } 
     2010    } 
     2011#endif 
     2012 
     2013    console_draw(); 
     2014} 
     2015 
     2016//------------------------------------------------------------------- 
     2017// Handler for Menu button press default - enter Menu mode 
     2018void gui_default_kbd_process_menu_btn() 
     2019{ 
     2020    gui_set_mode(GUI_MODE_MENU); 
     2021    draw_restore(); 
     2022} 
     2023 
     2024// Change SD override factor, direction = 1 to increase, -1 to decrease 
     2025// Only applies if camera has a Zoom lever 
     2026#if CAM_HAS_ZOOM_LEVER 
     2027static void sd_override_koef(int direction) 
     2028{ 
     2029    gui_subj_dist_override_koef_enum(direction,0); 
     2030#if !CAM_HAS_MANUAL_FOCUS 
     2031    if (conf.subj_dist_override_koef==0) conf.subj_dist_override_koef=1; 
     2032#endif 
     2033    shooting_set_focus(shooting_get_subject_distance_override_value(), SET_NOW); 
     2034} 
     2035#endif 
     2036 
     2037// Change SD override by factor amount, direction = 1 to increase (zoom in), -1 to decrease (zoom out) 
     2038static void sd_override(int direction) 
     2039{ 
     2040    gui_subj_dist_override_value_enum(direction,0); 
     2041    shooting_set_focus(shooting_get_subject_distance_override_value(),SET_NOW); 
     2042} 
     2043 
     2044// Main button processing for CHDK Alt mode (not in MENU mode) 
     2045// This needs to be cleaned up, re-organised and commented !!!! 
     2046void gui_chdk_kbd_process() 
     2047{ 
     2048#if !CAM_HAS_ERASE_BUTTON && CAM_CAN_SD_OVERRIDE        // ALT RAW toggle kbd processing if camera has SD override but no erase button 
     2049    if (kbd_is_key_clicked(SHORTCUT_TOGGLE_RAW)) 
     2050    { 
     2051        if (conf.debug_shortcut_action > 0) 
     2052        { 
     2053#ifdef OPT_DEBUGGING 
     2054            gui_debug_shortcut(); 
     2055#endif 
     2056        } 
     2057        // Check in manual focus mode 
     2058        else if (!shooting_get_common_focus_mode()) 
     2059        { 
     2060            // Not manual focus mode so just update RAW save setting 
     2061            conf.save_raw = !conf.save_raw; 
     2062            draw_restore(); 
     2063        } 
     2064        else 
     2065        { 
     2066            // In manual focus mode so update shooting distance 
     2067#if CAM_HAS_ZOOM_LEVER 
     2068            conf.subj_dist_override_value=MAX_DIST; 
     2069            shooting_set_focus(shooting_get_subject_distance_override_value(), SET_NOW); 
     2070#else 
     2071            if (conf.subj_dist_override_koef==4) 
     2072                gui_subj_dist_override_koef_enum(-3,0); 
     2073            else 
     2074                gui_subj_dist_override_koef_enum(1,0); 
     2075#endif 
     2076        } 
     2077    } 
     2078#else                                                   // ALT RAW toggle kbd processing if can't SD override or has erase button 
     2079    if (kbd_is_key_clicked(SHORTCUT_TOGGLE_RAW)) 
     2080    { 
     2081        if (conf.debug_shortcut_action > 0) 
     2082        { 
     2083#ifdef OPT_DEBUGGING 
     2084            gui_debug_shortcut(); 
     2085#endif 
     2086        } 
     2087        else 
     2088        { 
     2089            // Change RAW save state 
     2090            conf.save_raw = !conf.save_raw; 
     2091            draw_restore(); 
     2092        } 
     2093    } 
     2094#endif 
     2095#ifdef OPT_SCRIPTING                                    // ALT Set button processing if scripting enabled - open script menu 
     2096    else if (kbd_is_key_clicked(KEY_SET)) 
     2097    { 
     2098        gui_menu_init(&script_submenu); 
     2099        gui_default_kbd_process_menu_btn(); 
     2100    } 
     2101#endif 
     2102#if CAM_CAN_SD_OVERRIDE                                 // ALT button processing if camera has SD override 
     2103    else 
     2104    { 
     2105#if !CAM_HAS_MANUAL_FOCUS 
     2106        if (kbd_is_key_clicked(SHORTCUT_MF_TOGGLE))     // Camera does not have manual focus 
     2107        { 
     2108            if (conf.subj_dist_override_koef>0) 
     2109                conf.subj_dist_override_koef=0; 
     2110            else conf.subj_dist_override_koef=1; 
     2111            draw_restore(); 
     2112        } 
     2113        else 
     2114#endif 
     2115        if (shooting_get_common_focus_mode())           // Check in manual focus mode 
     2116        { 
     2117#if CAM_HAS_ZOOM_LEVER                                  // Camera has zoom lever, use left & right to change factor,up to set infinity 
     2118            if (kbd_is_key_clicked(KEY_RIGHT)) 
     2119            { 
     2120                sd_override_koef(1); 
     2121            } 
     2122            else if (kbd_is_key_clicked(KEY_LEFT)) 
     2123            { 
     2124                sd_override_koef(-1); 
     2125            } 
     2126            else if (kbd_is_key_clicked(SHORTCUT_SET_INFINITY)) 
     2127            { 
     2128                conf.subj_dist_override_value=MAX_DIST; 
     2129                shooting_set_focus(shooting_get_subject_distance_override_value(), SET_NOW); 
     2130            } 
     2131            else 
     2132#endif 
     2133            if (kbd_is_key_clicked(SHORTCUT_SET_HYPERFOCAL))    // Set hyperfocal distance if down pressed 
     2134            { 
     2135                int m=mode_get()&MODE_SHOOTING_MASK; 
     2136                if ((m==MODE_M) || (m==MODE_AV)) 
     2137                     conf.subj_dist_override_value=(int)shooting_get_hyperfocal_distance_f(shooting_get_aperture_from_av96(shooting_get_user_av96()),get_focal_length(lens_get_zoom_point())); 
     2138                else conf.subj_dist_override_value=(int)shooting_get_hyperfocal_distance(); 
     2139                shooting_set_focus(shooting_get_subject_distance_override_value(), SET_NOW); 
     2140            } 
     2141            else 
     2142            { 
     2143                switch (kbd_get_autoclicked_key()) 
     2144                { 
     2145#if CAM_HAS_ZOOM_LEVER 
     2146                case KEY_ZOOM_IN: 
     2147#else 
     2148                case KEY_RIGHT: 
     2149#endif 
     2150                    sd_override(1); 
     2151                    break; 
     2152#if CAM_HAS_ZOOM_LEVER 
     2153                case KEY_ZOOM_OUT: 
     2154#else 
     2155                case KEY_LEFT: 
     2156#endif 
     2157                    sd_override(-1); 
     2158                    break; 
     2159                } 
     2160            } 
     2161        } 
     2162    } 
     2163#endif 
     2164} 
     2165 
     2166//------------------------------------------------------------------- 
     2167// Handler for Menu button press in CHDK Alt mode (not in Menu mode) 
     2168// Enter main menu or user menu based on configuration 
     2169void gui_chdk_kbd_process_menu_btn() 
     2170{ 
     2171    if (conf.user_menu_as_root && (conf.user_menu_enable != 0)) { 
     2172        if (kbd_is_key_pressed(KEY_SHOOT_HALF)) 
     2173            gui_menu_init(&root_menu); 
     2174        else 
     2175            gui_menu_init(&user_submenu); 
     2176    } 
     2177    else { 
     2178        if ((conf.user_menu_enable != 0) && kbd_is_key_pressed(KEY_SHOOT_HALF)) 
     2179            gui_menu_init(&user_submenu); 
     2180        else 
     2181            gui_menu_init(&root_menu); 
     2182    } 
     2183    gui_default_kbd_process_menu_btn(); 
     2184} 
     2185 
     2186// Menu button handled for text reader 
     2187#ifdef OPT_TEXTREADER 
     2188void gui_read_kbd_process_menu_btn() 
     2189{ 
     2190    gui_read_kbd_process(); 
     2191    gui_default_kbd_process_menu_btn(); 
     2192} 
     2193#endif 
     2194 
     2195// Menu button handled for Menu mode 
     2196void gui_menu_kbd_process_menu_btn() 
     2197{ 
     2198#ifdef OPTIONS_AUTOSAVE 
     2199    conf_save_new_settings_if_changed(); 
     2200#endif 
     2201    if (gui_user_menu_flag) 
     2202    { 
     2203        gui_set_mode(GUI_MODE_MENU); 
     2204        gui_user_menu_flag = 0; 
     2205        gui_menu_init(&root_menu); 
     2206    } 
     2207    else 
     2208        gui_set_mode(GUI_MODE_ALT); 
     2209    draw_restore(); 
     2210} 
     2211 
     2212//------------------------------------------------------------------- 
     2213// Structure to store gui redraw and kbd process handlers for each mode 
     2214typedef struct 
     2215{ 
     2216    void (*redraw)(void);                   // Called to redraw screen 
     2217    void (*kbd_process)(void);              // Main button handler for mode 
     2218    void (*kbd_process_menu_btn)(void);     // Menu button handler for mode 
     2219} gui_handler; 
     2220 
     2221// GUI handler table (entries must be in the same order and have the same number of entries as Gui_Mode enum) 
     2222gui_handler guiHandlers[] = 
     2223{ 
     2224    /*GUI_MODE_NONE*/           { gui_draw_osd,         0,                          0 }, 
     2225    /*GUI_MODE_ALT*/            { gui_chdk_draw,        gui_chdk_kbd_process,       gui_chdk_kbd_process_menu_btn }, 
     2226    /*GUI_MODE_MENU*/           { gui_menu_draw,        gui_menu_kbd_process,       gui_menu_kbd_process_menu_btn }, 
     2227    /*GUI_MODE_PALETTE*/        { gui_palette_draw,     gui_palette_kbd_process,    gui_default_kbd_process_menu_btn }, 
     2228    /*GUI_MODE_MBOX*/           { gui_mbox_draw,        gui_mbox_kbd_process,       0 }, 
     2229#ifdef OPT_GAME_REVERSI 
     2230    /*GUI_MODE_REVERSI*/        { gui_reversi_draw,     gui_reversi_kbd_process,    gui_default_kbd_process_menu_btn }, 
     2231#else 
     2232                                { 0, 0, 0 }, 
     2233#endif 
     2234#ifdef OPT_GAME_SOKOBAN 
     2235    /*GUI_MODE_SOKOBAN*/        { gui_sokoban_draw,     gui_sokoban_kbd_process,    gui_default_kbd_process_menu_btn }, 
     2236#else 
     2237                                { 0, 0, 0 }, 
     2238#endif 
     2239#ifdef OPT_DEBUGGING 
     2240    /*GUI_MODE_DEBUG*/          { gui_debug_draw,       gui_debug_kbd_process,      gui_default_kbd_process_menu_btn }, 
     2241#else 
     2242                                { 0, 0, 0 }, 
     2243#endif 
     2244    /*GUI_MODE_FSELECT*/        { gui_fselect_draw,     gui_fselect_kbd_process,    gui_fselect_kbd_process }, 
     2245#ifdef OPT_TEXTREADER 
     2246    /*GUI_MODE_READ*/           { gui_read_draw,        gui_read_kbd_process,       gui_read_kbd_process_menu_btn }, 
     2247#else 
     2248                                { 0, 0, 0 }, 
     2249#endif 
     2250    /*GUI_MODE_OSD*/            { gui_osd_draw,         gui_osd_kbd_process,        gui_default_kbd_process_menu_btn }, 
     2251#ifdef OPT_CALENDAR 
     2252    /*GUI_MODE_CALENDAR*/       { gui_calendar_draw,    gui_calendar_kbd_process,   gui_default_kbd_process_menu_btn }, 
     2253#else 
     2254                                { 0, 0, 0 }, 
     2255#endif 
     2256#ifdef OPT_DEBUGGING 
     2257    /*GUI_MODE_BENCH*/          { gui_bench_draw,       gui_bench_kbd_process,      gui_default_kbd_process_menu_btn }, 
     2258#else 
     2259                                { 0, 0, 0 }, 
     2260#endif 
     2261    /*GUI_MODE_MPOPUP*/         { gui_mpopup_draw,      gui_mpopup_kbd_process,     0 }, 
     2262#ifdef OPT_GAME_CONNECT4 
     2263    /*GUI_MODE_4WINS*/          { gui_4wins_draw,       gui_4wins_kbd_process,      gui_default_kbd_process_menu_btn }, 
     2264#else 
     2265                                { 0, 0, 0 }, 
     2266#endif 
     2267#ifdef OPT_GAME_MASTERMIND 
     2268    /*GUI_MODE_MASTERMIND*/     { gui_mastermind_draw,  gui_mastermind_kbd_process, gui_default_kbd_process_menu_btn }, 
     2269#else 
     2270                                { 0, 0, 0 }, 
     2271#endif 
     2272}; 
     2273 
     2274//------------------------------------------------------------------- 
     2275// Main GUI redraw function, perform common initialisation then calls the redraw handler for the mode 
    19322276void gui_redraw() 
    19332277{ 
    19342278    enum Gui_Mode gui_mode_old; 
    1935     static int show_md_grid=0; 
    19362279 
    19372280#ifdef CAM_DETECT_SCREEN_ERASE 
     
    19412284        gui_menu_force_redraw(); 
    19422285        gui_fselect_force_redraw(); 
     2286#ifdef CAM_TOUCHSCREEN_UI 
     2287        extern int redraw_buttons; 
     2288        redraw_buttons = 1; 
     2289#endif 
    19432290    } 
    19442291#endif 
     
    19492296    gui_mode_old = gui_mode; 
    19502297 
    1951     #if CAM_USES_ASPECT_CORRECTION //nandoide sept-2009 
     2298#if CAM_USES_ASPECT_CORRECTION //nandoide sept-2009 
    19522299    //the different modes arises because games are designed on a 360x240 basis and are difficult to downscale to 320x240 
    19532300    if (gui_mode == GUI_MODE_REVERSI || gui_mode == GUI_MODE_SOKOBAN || gui_mode == GUI_MODE_4WINS || gui_mode == GUI_MODE_MASTERMIND) { 
    19542301      draw_set_environment(aspect_xcorrection_games_360, aspect_ycorrection_games_360, GAMES_SCREEN_WIDTH, GAMES_SCREEN_HEIGHT); 
    19552302   } else { //default 
    1956 //      draw_set_environment(NULL, NULL, SCREENX, SCREENY); 
    19572303      draw_set_environment(NULL, NULL, vid_get_bitmap_screen_width(), vid_get_bitmap_screen_height()); 
    19582304   } 
    1959     #endif 
    1960     switch (gui_mode) { 
    1961         case GUI_MODE_MENU: 
    1962             gui_menu_draw(); 
    1963 //            draw_txt_string(20, 14, "<CNF>", MAKE_COLOR(COLOR_ALT_BG, COLOR_FG)); 
    1964             break; 
    1965         case GUI_MODE_ALT: 
    1966             gui_draw_osd(); 
    1967             draw_txt_string(20, 14, "<ALT>", MAKE_COLOR(COLOR_ALT_BG, COLOR_FG)); 
    1968 #ifdef OPT_SCRIPTING 
    1969             if ((mode_get()&MODE_MASK) == MODE_REC) { 
    1970                 draw_txt_string(0, 14, script_title, MAKE_COLOR(COLOR_ALT_BG, COLOR_FG)); 
    1971                 if (state_kbd_script_run) show_md_grid=5; 
    1972                 if (show_md_grid) { 
    1973                     --show_md_grid; 
    1974                     md_draw_grid(); 
    1975                 } 
    1976             } 
    1977 #endif 
    1978             console_draw(); 
    1979             break; 
    1980         case GUI_MODE_NONE: 
    1981             gui_draw_osd(); 
    1982             break; 
    1983         case GUI_MODE_PALETTE: 
    1984             gui_palette_draw(); 
    1985             break; 
    1986         case GUI_MODE_MBOX: 
    1987             gui_mbox_draw(); 
    1988             break; 
    1989 #ifdef OPT_GAME_REVERSI 
    1990         case GUI_MODE_REVERSI: 
    1991             gui_reversi_draw(); 
    1992             break; 
    1993 #endif 
    1994 #ifdef OPT_GAME_SOKOBAN 
    1995         case GUI_MODE_SOKOBAN: 
    1996             gui_sokoban_draw(); 
    1997             break; 
    1998 #endif 
    1999 #ifdef OPT_GAME_CONNECT4 
    2000         case GUI_MODE_4WINS: 
    2001             gui_4wins_draw(); 
    2002             break; 
    2003 #endif 
    2004 #ifdef OPT_GAME_MASTERMIND 
    2005         case GUI_MODE_MASTERMIND: 
    2006             gui_mastermind_draw(); 
    2007             break; 
    2008 #endif 
    2009 #ifdef OPT_DEBUGGING 
    2010         case GUI_MODE_DEBUG: 
    2011             gui_debug_draw(); 
    2012             break; 
    2013 #endif 
    2014         case GUI_MODE_FSELECT: 
    2015             gui_fselect_draw(); 
    2016             break; 
    2017 #ifdef OPT_TEXTREADER 
    2018         case GUI_MODE_READ: 
    2019             gui_read_draw(); 
    2020             break; 
    2021 #endif 
    2022         case GUI_MODE_OSD: 
    2023             gui_osd_draw(); 
    2024 //            draw_txt_string(20, 14, "<OSD>", MAKE_COLOR(COLOR_ALT_BG, COLOR_FG)); 
    2025             break; 
    2026 #ifdef OPT_CALENDAR 
    2027         case GUI_MODE_CALENDAR: 
    2028             gui_calendar_draw(); 
    2029             break; 
    2030 #endif 
    2031 #ifdef OPT_DEBUGGING 
    2032         case GUI_MODE_BENCH: 
    2033             gui_bench_draw(); 
    2034             break; 
    2035 #endif 
    2036         case GUI_MODE_MPOPUP: 
    2037             gui_mpopup_draw(); 
    2038             break; 
    2039         default: 
    2040             break; 
    2041     } 
    2042  
     2305#endif 
     2306 
     2307#ifdef CAM_TOUCHSCREEN_UI 
     2308    extern void virtual_buttons(); 
     2309    virtual_buttons(); 
     2310#endif 
     2311 
     2312    // Call redraw handler 
     2313    if (guiHandlers[gui_mode].redraw) guiHandlers[gui_mode].redraw(); 
     2314 
     2315    // Forced redraw if needed 
    20432316    gui_in_redraw = 0; 
    20442317    if ((gui_mode_old != gui_mode && (gui_mode_old != GUI_MODE_NONE && gui_mode_old != GUI_MODE_ALT) && (gui_mode != GUI_MODE_MBOX && gui_mode != GUI_MODE_MPOPUP)) || gui_restore) { 
     
    20502323} 
    20512324 
    2052 #ifdef OPTIONS_AUTOSAVE 
    2053 //------------------------------------------------------------------- 
    2054 static inline void conf_store_old_settings() { 
    2055     old_conf=conf; 
    2056 } 
    2057  
    2058 //------------------------------------------------------------------- 
    2059 static inline int conf_save_new_settings_if_changed() { 
    2060     if (memcmp(&old_conf, &conf, sizeof(Conf)) != 0) { 
    2061                 user_menu_save(); 
    2062         conf_save(); 
    2063         conf_store_old_settings(); 
    2064         return 1; 
    2065     } 
    2066     return 0; 
    2067 } 
    2068 #endif 
    2069  
    2070  
    2071 //------------------------------------------------------------------- 
     2325//------------------------------------------------------------------- 
     2326// Main kbd processing for GUI modes 
    20722327void gui_kbd_process() 
    20732328{ 
    2074     int clicked_key; 
    2075  
    2076     if (kbd_is_key_clicked(KEY_MENU)){ 
    2077         switch (gui_mode) { 
    2078             case GUI_MODE_ALT: 
    2079                                 if (conf.user_menu_as_root && (conf.user_menu_enable != 0)) { 
    2080                                 if (kbd_is_key_pressed(KEY_SHOOT_HALF)) 
    2081                                         gui_menu_init(&root_menu); 
    2082                                 else 
    2083                 gui_menu_init(&user_submenu); 
    2084                                 } 
    2085                                 else { 
    2086                                 if ((conf.user_menu_enable != 0) && kbd_is_key_pressed(KEY_SHOOT_HALF)) 
    2087                                         gui_menu_init(&user_submenu); 
    2088                                 else 
    2089                 gui_menu_init(&root_menu); 
    2090                                 } 
    2091                 gui_mode = GUI_MODE_MENU; 
    2092                 draw_restore(); 
    2093                 break; 
    2094             case GUI_MODE_MENU: 
    2095 #ifdef OPTIONS_AUTOSAVE 
    2096                 conf_save_new_settings_if_changed(); 
    2097 #endif 
    2098                                 if (gui_user_menu_flag) { 
    2099                         gui_mode = GUI_MODE_MENU; 
    2100                                         gui_user_menu_flag = 0; 
    2101                                         gui_menu_init(&root_menu); 
    2102                                 } 
    2103                                 else 
    2104                 gui_mode = GUI_MODE_ALT; 
    2105                 draw_restore(); 
    2106                 break; 
    2107             case GUI_MODE_PALETTE: 
    2108             case GUI_MODE_REVERSI: 
    2109             case GUI_MODE_SOKOBAN: 
    2110             case GUI_MODE_4WINS: 
    2111                         case GUI_MODE_MASTERMIND: 
    2112 #ifdef OPT_DEBUGGING 
    2113             case GUI_MODE_DEBUG: 
    2114 #endif 
    2115             case GUI_MODE_OSD: 
    2116 #ifdef OPT_CALENDAR 
    2117             case GUI_MODE_CALENDAR: 
    2118 #endif 
    2119             case GUI_MODE_BENCH: 
    2120                 draw_restore(); 
    2121                 gui_mode = GUI_MODE_MENU; 
    2122                 break; 
    2123             case GUI_MODE_FSELECT: 
    2124                 gui_fselect_kbd_process(); 
    2125                 break; 
    2126 #ifdef OPT_TEXTREADER 
    2127             case GUI_MODE_READ: 
    2128                 gui_read_kbd_process(); 
    2129                 draw_restore(); 
    2130                 gui_mode = GUI_MODE_MENU; 
    2131                 break; 
    2132 #endif 
    2133             default: 
    2134                 break; 
    2135         } 
     2329    // Call menu button handler if menu button pressed 
     2330    if (kbd_is_key_clicked(KEY_MENU)) 
     2331    { 
     2332        if (guiHandlers[gui_mode].kbd_process_menu_btn) guiHandlers[gui_mode].kbd_process_menu_btn(); 
    21362333        return; 
    21372334    } 
    21382335 
    2139     switch (gui_mode) { 
    2140         case GUI_MODE_ALT: 
    2141             if (kbd_is_key_clicked(SHORTCUT_TOGGLE_RAW)) { 
    2142                 if (conf.debug_shortcut_action > 0) { 
    2143 #ifdef OPT_DEBUGGING 
    2144                                         gui_debug_shortcut(); 
    2145 #endif 
    2146 } 
    2147 #if !CAM_HAS_ERASE_BUTTON && CAM_CAN_SD_OVERRIDE 
    2148                 else if (!shooting_get_common_focus_mode()) 
    2149 #else 
    2150                                 else 
    2151 #endif 
    2152                                    {conf.save_raw = !conf.save_raw; 
    2153                     draw_restore(); 
    2154                    } 
    2155 #if !CAM_HAS_ERASE_BUTTON && CAM_CAN_SD_OVERRIDE 
    2156                                 else { 
    2157    #if CAM_HAS_ZOOM_LEVER 
    2158                conf.subj_dist_override_value=MAX_DIST; 
    2159                shooting_set_focus(shooting_get_subject_distance_override_value(), SET_NOW); 
    2160    #else 
    2161                if (conf.subj_dist_override_koef==4) 
    2162                   gui_subj_dist_override_koef_enum(-3,0); 
    2163                else 
    2164                   gui_subj_dist_override_koef_enum(1,0); 
    2165    #endif 
    2166                                 } 
    2167 #endif 
    2168 #ifdef OPT_SCRIPTING 
    2169             } else if (kbd_is_key_clicked(KEY_SET)) { 
    2170                 gui_menu_init(&script_submenu); 
    2171                 gui_mode = GUI_MODE_MENU; 
    2172                 draw_restore(); 
    2173 #endif 
    2174             } else { 
    2175 #if !CAM_HAS_MANUAL_FOCUS && CAM_CAN_SD_OVERRIDE 
    2176                         if (kbd_is_key_clicked(SHORTCUT_MF_TOGGLE)) { 
    2177                               if (conf.subj_dist_override_koef>0) 
    2178                                      conf.subj_dist_override_koef=0; 
    2179                               else conf.subj_dist_override_koef=1; 
    2180                               draw_restore(); 
    2181                              } 
    2182                 else if (shooting_get_common_focus_mode()) 
    2183 #elif CAM_CAN_SD_OVERRIDE 
    2184                if (shooting_get_common_focus_mode()) 
    2185 #endif 
    2186  
    2187 #if CAM_CAN_SD_OVERRIDE 
    2188                           { 
    2189   #if CAM_HAS_ZOOM_LEVER 
    2190                                 if (kbd_is_key_clicked(KEY_RIGHT)) { 
    2191                                   gui_subj_dist_override_koef_enum(1,0); 
    2192     #if !CAM_HAS_MANUAL_FOCUS 
    2193                   if (conf.subj_dist_override_koef==0) conf.subj_dist_override_koef=1; 
    2194     #endif 
    2195                   shooting_set_focus(shooting_get_subject_distance_override_value(), SET_NOW); 
    2196                                   } 
    2197                                 else if (kbd_is_key_clicked(KEY_LEFT)) 
    2198                                   { 
    2199                                   gui_subj_dist_override_koef_enum(-1,0); 
    2200     #if !CAM_HAS_MANUAL_FOCUS 
    2201                   if (conf.subj_dist_override_koef==0) conf.subj_dist_override_koef=1; 
    2202     #endif 
    2203                   shooting_set_focus(shooting_get_subject_distance_override_value(), SET_NOW); 
    2204                                   } 
    2205                                 else if (kbd_is_key_clicked(SHORTCUT_SET_INFINITY)) 
    2206                                   { 
    2207                                   conf.subj_dist_override_value=MAX_DIST; 
    2208                   shooting_set_focus(shooting_get_subject_distance_override_value(), SET_NOW); 
    2209                                   } 
    2210                                 else 
    2211   #endif 
    2212                                 if (kbd_is_key_clicked(SHORTCUT_SET_HYPERFOCAL)) 
    2213                                   { 
    2214                                   int m=mode_get()&MODE_SHOOTING_MASK; 
    2215                                   if ((m==MODE_M) || (m==MODE_AV)) 
    2216                                     conf.subj_dist_override_value=(int)shooting_get_hyperfocal_distance_f(shooting_get_aperture_from_av96(shooting_get_user_av96()),get_focal_length(lens_get_zoom_point())); 
    2217                                   else conf.subj_dist_override_value=(int)shooting_get_hyperfocal_distance(); 
    2218                   shooting_set_focus(shooting_get_subject_distance_override_value(), SET_NOW); 
    2219                                   } 
    2220                                 else 
    2221                   switch (kbd_get_autoclicked_key()) { 
    2222   #if CAM_HAS_ZOOM_LEVER 
    2223                     case KEY_ZOOM_IN: 
    2224   #else 
    2225                     case KEY_RIGHT: 
    2226   #endif 
    2227                         gui_subj_dist_override_value_enum(1,0); 
    2228                         shooting_set_focus(shooting_get_subject_distance_override_value(),SET_NOW); 
    2229                         break; 
    2230   #if CAM_HAS_ZOOM_LEVER 
    2231                     case KEY_ZOOM_OUT: 
    2232   #else 
    2233                     case KEY_LEFT: 
    2234   #endif 
    2235                         gui_subj_dist_override_value_enum(-1,0); 
    2236                         shooting_set_focus(shooting_get_subject_distance_override_value(), SET_NOW); 
    2237                         break; 
    2238                   } 
    2239               } 
    2240 #endif 
    2241             } 
    2242             break; 
    2243         case GUI_MODE_MENU: 
    2244             gui_menu_kbd_process(); 
    2245             break; 
    2246         case GUI_MODE_PALETTE: 
    2247             gui_palette_kbd_process(); 
    2248             break; 
    2249         case GUI_MODE_MBOX: 
    2250             gui_mbox_kbd_process(); 
    2251             break; 
    2252 #ifdef OPT_GAME_REVERSI 
    2253         case GUI_MODE_REVERSI: 
    2254             gui_reversi_kbd_process(); 
    2255             break; 
    2256 #endif 
    2257 #ifdef OPT_GAME_SOKOBAN 
    2258         case GUI_MODE_SOKOBAN: 
    2259             gui_sokoban_kbd_process(); 
    2260             break; 
    2261 #endif 
    2262 #ifdef OPT_GAME_CONNECT4 
    2263         case GUI_MODE_4WINS: 
    2264             gui_4wins_kbd_process(); 
    2265             break; 
    2266 #endif 
    2267 #ifdef OPT_GAME_MASTERMIND 
    2268         case GUI_MODE_MASTERMIND: 
    2269             gui_mastermind_kbd_process(); 
    2270             break; 
    2271 #endif 
    2272 #ifdef OPT_DEBUGGING 
    2273         case GUI_MODE_DEBUG: 
    2274             gui_debug_kbd_process(); 
    2275             break; 
    2276 #endif 
    2277         case GUI_MODE_FSELECT: 
    2278             gui_fselect_kbd_process(); 
    2279             break; 
    2280 #ifdef OPT_TEXTREADER 
    2281         case GUI_MODE_READ: 
    2282             gui_read_kbd_process(); 
    2283             break; 
    2284 #endif 
    2285         case GUI_MODE_OSD: 
    2286             gui_osd_kbd_process(); 
    2287             break; 
    2288 #ifdef OPT_CALENDAR 
    2289         case GUI_MODE_CALENDAR: 
    2290             gui_calendar_kbd_process(); 
    2291             break; 
    2292 #endif 
    2293 #ifdef OPT_DEBUGGING 
    2294         case GUI_MODE_BENCH: 
    2295             gui_bench_kbd_process(); 
    2296             break; 
    2297 #endif 
    2298         case GUI_MODE_MPOPUP: 
    2299             gui_mpopup_kbd_process(); 
    2300              break; 
    2301         default: 
    2302             break; 
    2303     } 
     2336    // Call mode handler for other buttons 
     2337    if (guiHandlers[gui_mode].kbd_process) guiHandlers[gui_mode].kbd_process(); 
    23042338} 
    23052339 
     
    23112345    conf_store_old_settings(); 
    23122346#endif 
    2313     gui_mode = GUI_MODE_ALT; 
     2347    gui_set_mode(GUI_MODE_ALT); 
    23142348 
    23152349        conf_update_prevent_shutdown(); 
     
    23202354        if (conf.user_menu_enable == 2) { 
    23212355                gui_menu_init(&user_submenu); 
    2322                 gui_mode = GUI_MODE_MENU; 
     2356                gui_set_mode(GUI_MODE_MENU); 
    23232357                draw_restore(); 
    23242358                gui_user_menu_flag = 1; 
     
    23422376    rbf_set_codepage(FONT_CP_WIN); 
    23432377    vid_turn_on_updates(); 
    2344     gui_mode = GUI_MODE_NONE; 
     2378    gui_set_mode(GUI_MODE_NONE); 
    23452379 
    23462380        conf_update_prevent_shutdown(); 
     
    23812415 
    23822416#if CAM_EV_IN_VIDEO 
    2383  if ((movie_status==VIDEO_RECORD_IN_PROGRESS) && !kbd_is_key_pressed(KEY_SHOOT_HALF)){ 
    2384   #if CAM_HAS_ERASE_BUTTON 
    2385   if (kbd_is_key_clicked(KEY_ERASE)){ 
    2386   #else 
    2387   #if !defined (CAMERA_a480) 
    2388   if (kbd_is_key_clicked(KEY_DISPLAY)){ 
    2389   #else 
    2390   if (kbd_is_key_clicked(KEY_MENU)){ 
    2391   #endif 
    2392   #endif 
    2393    set_ev_video_avail(!get_ev_video_avail()); 
    2394   } 
    2395   if (get_ev_video_avail()) { 
    2396    if (kbd_is_key_clicked(KEY_LEFT)) { 
    2397     set_ev_video(get_ev_video()-1); 
    2398    } 
    2399    if (kbd_is_key_clicked(KEY_RIGHT)){ 
    2400     set_ev_video(get_ev_video()+1); 
    2401    } 
    2402   } 
    2403  } 
     2417    if ((movie_status==VIDEO_RECORD_IN_PROGRESS) && !kbd_is_key_pressed(KEY_SHOOT_HALF)){ 
     2418#if CAM_HAS_ERASE_BUTTON 
     2419        if (kbd_is_key_clicked(KEY_ERASE)){ 
     2420#else 
     2421#if !defined (CAMERA_a480) 
     2422        if (kbd_is_key_clicked(KEY_DISPLAY)){ 
     2423#else 
     2424        if (kbd_is_key_clicked(KEY_MENU)){ 
     2425#endif 
     2426#endif 
     2427            set_ev_video_avail(!get_ev_video_avail()); 
     2428#ifdef CAM_TOUCHSCREEN_UI 
     2429            redraw_buttons = 1; 
     2430#endif 
     2431        } 
     2432        if (get_ev_video_avail()) { 
     2433            if (kbd_is_key_clicked(KEY_LEFT)) { 
     2434                set_ev_video(get_ev_video()-1); 
     2435            } 
     2436            if (kbd_is_key_clicked(KEY_RIGHT)){ 
     2437                set_ev_video(get_ev_video()+1); 
     2438            } 
     2439        } 
     2440    } 
    24042441#endif 
    24052442} 
     
    24092446 
    24102447#if defined(OPT_EXMEM_TESTING) 
    2411         // If defined the exmem memory is allocated; but not used for CHDK. 
    2412         // It is filled with a guard value (see wrappers.c) which is checked here 
    2413     // Any corruption is reported, otherwise 'OK' is displayed on screen (along with the exmem memory start address). 
    2414         extern void *exmem_start, *exmem_end; 
    2415         // check exmem allocated memory for corruption 
    2416         unsigned long* p = (unsigned long*)exmem_start; 
    2417         unsigned long *f = 0, *l = 0; 
    2418         long cnt = 0; 
    2419         while (p < (unsigned long*)exmem_end) 
    2420         { 
    2421                 if (p[0] != 0xDEADBEEF) 
    2422                 { 
    2423                         l = p; 
    2424                         if (f == 0) f = p; 
    2425                         cnt++; 
    2426                 } 
    2427                 p++; 
    2428         } 
    2429         if (cnt != 0) 
    2430         { 
    2431                 sprintf(osd_buf, "s:%8x e:%8x", exmem_start, exmem_end); 
    2432                 draw_txt_string(2, 12, osd_buf, conf.osd_color); 
    2433                 sprintf(osd_buf, "f:%8x l:%8x c:%d", f, l, cnt); 
    2434         } 
    2435         else 
    2436         { 
    2437                 sprintf(osd_buf, "OK 0x%x", exmem_start); 
    2438         } 
    2439         draw_txt_string(2, 13, osd_buf, conf.osd_color); 
    2440         // end of check  
     2448    // Only do memory corruption testing if not recording video 
     2449    if (!MODE_IS_VIDEO(mode_get())) 
     2450    { 
     2451            // If defined the exmem memory is allocated; but not used for CHDK. 
     2452            // It is filled with a guard value (see wrappers.c) which is checked here 
     2453        // Any corruption is reported, otherwise 'OK' is displayed on screen (along with the exmem memory start address). 
     2454            extern void *exmem_start, *exmem_end; 
     2455            // check exmem allocated memory for corruption 
     2456            unsigned long* p = (unsigned long*)exmem_start; 
     2457            unsigned long *f = 0, *l = 0; 
     2458            long cnt = 0; 
     2459            while (p < (unsigned long*)exmem_end) 
     2460            { 
     2461                    if (p[0] != 0xDEADBEEF) 
     2462                    { 
     2463                            l = p; 
     2464                            if (f == 0) f = p; 
     2465                            cnt++; 
     2466                    } 
     2467                    p++; 
     2468            } 
     2469            if (cnt != 0) 
     2470            { 
     2471                    sprintf(osd_buf, "s:%8x e:%8x", exmem_start, exmem_end); 
     2472                    draw_txt_string(2, 12, osd_buf, conf.osd_color); 
     2473                    sprintf(osd_buf, "f:%8x l:%8x c:%d", f, l, cnt); 
     2474            } 
     2475            else 
     2476            { 
     2477                    sprintf(osd_buf, "OK 0x%x", exmem_start); 
     2478            } 
     2479            draw_txt_string(2, 13, osd_buf, conf.osd_color); 
     2480            // end of check      
     2481    } 
    24412482#endif 
    24422483 
     
    27512792    draw_restore(); 
    27522793    gui_palette_init(PALETTE_MODE_DEFAULT, 0x00, NULL); 
    2753     gui_mode = GUI_MODE_PALETTE; 
     2794    gui_set_mode(GUI_MODE_PALETTE); 
    27542795} 
    27552796 
     
    27912832      draw_set_environment(aspect_xcorrection_games_360, aspect_ycorrection_games_360, GAMES_SCREEN_WIDTH, GAMES_SCREEN_HEIGHT); 
    27922833    #endif 
    2793     gui_mode = GUI_MODE_REVERSI; 
     2834    gui_set_mode(GUI_MODE_REVERSI); 
    27942835    gui_reversi_init(); 
    27952836} 
     
    28082849    #endif 
    28092850    if ( gui_sokoban_init() ) 
    2810         gui_mode = GUI_MODE_SOKOBAN; 
     2851        gui_set_mode(GUI_MODE_SOKOBAN); 
    28112852} 
    28122853#endif 
     
    28232864    #endif 
    28242865    if ( gui_4wins_init() ) 
    2825         gui_mode = GUI_MODE_4WINS; 
     2866        gui_set_mode(GUI_MODE_4WINS); 
    28262867} 
    28272868#endif 
     
    28382879    #endif 
    28392880   if ( gui_mastermind_init() ) 
    2840         gui_mode = GUI_MODE_MASTERMIND; 
     2881        gui_set_mode(GUI_MODE_MASTERMIND); 
    28412882} 
    28422883#endif 
     
    28542895#ifdef OPT_DEBUGGING 
    28552896void gui_draw_bench(int arg) { 
    2856     gui_mode = GUI_MODE_BENCH; 
     2897    gui_set_mode(GUI_MODE_BENCH); 
    28572898    gui_bench_init(); 
    28582899} 
     
    29432984//------------------------------------------------------------------- 
    29442985void gui_draw_osd_le(int arg) { 
    2945     gui_mode = GUI_MODE_OSD; 
     2986    gui_set_mode(GUI_MODE_OSD); 
    29462987    gui_osd_init(); 
    29472988} 
     
    29542995            rbf_load_from_8x16(current_font); 
    29552996        rbf_set_codepage(conf.reader_codepage); 
    2956         gui_mode = GUI_MODE_READ; 
     2997        gui_set_mode(GUI_MODE_READ); 
    29572998        gui_read_init(fn); 
    29582999    } 
     
    29913032void gui_menuproc_mkbootdisk(int arg) { 
    29923033    mark_filesystem_bootable(); 
     3034    gui_mbox_init(LANG_INFORMATION, LANG_CONSOLE_TEXT_FINISHED, MBOX_BTN_OK|MBOX_TEXT_CENTER, NULL); 
    29933035} 
    29943036 
     
    30233065#ifdef OPT_CALENDAR 
    30243066void gui_draw_calendar(int arg) { 
    3025     gui_mode = GUI_MODE_CALENDAR; 
     3067    gui_set_mode(GUI_MODE_CALENDAR); 
    30263068    gui_calendar_init(); 
    30273069} 
    30283070#endif 
    30293071//------------------------------------------------------------------- 
     3072#ifdef OPT_TEXTREADER 
    30303073static void gui_draw_rbf_selected(const char *fn) { 
    30313074    if (fn) { 
     
    30333076    } 
    30343077} 
    3035 #ifdef OPT_TEXTREADER 
    30363078void gui_draw_load_rbf(int arg) { 
    30373079    DIR   *d; 
  • trunk/core/gui_4wins.c

    r1323 r1338  
    1515 
    1616#define BORDER           20 
     17#define XBORDER          (CAM_TS_BUTTON_BORDER+BORDER) 
    1718#define RECT_SIZE        30 
    1819#define BORDER_TOP       RECT_SIZE 
     
    5253                for(i=1;field[column-1][i];i++);                        //1 ist wichtig (0=Fundament) 
    5354                if (visible) { 
    54                         draw_filled_ellipse((BORDER+((column-1)*RECT_SIZE))+15, (BORDER+((6-i)*RECT_SIZE))+15+BORDER_TOP, 10,10, (cur_player==1)?P1_COLOR:P2_COLOR); 
     55                        draw_filled_ellipse((XBORDER+((column-1)*RECT_SIZE))+15, (BORDER+((6-i)*RECT_SIZE))+15+BORDER_TOP, 10,10, (cur_player==1)?P1_COLOR:P2_COLOR); 
    5556                } 
    5657                field[column-1][i]=player; 
     
    172173    w=l*FONT_WIDTH+10; 
    173174 
    174     x = (screen_width-w)>>1; y = ((screen_height)>>1); 
     175    x = (screen_width-CAM_TS_BUTTON_BORDER-w)>>1; y = ((screen_height)>>1); 
    175176    draw_filled_round_rect(x, y, x+w, y+FONT_HEIGHT+6, MAKE_COLOR(COLOR_RED, COLOR_RED)); 
    176177    draw_string(x+((w-strlen(text)*FONT_WIDTH)>>1), y+4, text, cl); 
     
    180181{ 
    181182        if (cur_player==1) cur_player=2; else cur_player=1; 
    182         draw_filled_ellipse((BORDER+((cursor_position)*RECT_SIZE))+15, BORDER+10, 10,10, (cur_player==1)?P1_COLOR:P2_COLOR); 
     183        draw_filled_ellipse((XBORDER+((cursor_position)*RECT_SIZE))+15, BORDER+10, 10,10, (cur_player==1)?P1_COLOR:P2_COLOR); 
    183184} 
    184185//------------------------------------------------------------------- 
     
    237238void draw_mode() 
    238239{ 
    239         draw_txt_string(30, 4, "            ", TEXT_COLOR); 
     240    int x = (CAM_TS_BUTTON_BORDER/FONT_WIDTH) + 30; 
     241        draw_txt_string(x, 4, "            ", TEXT_COLOR); 
    240242        if (mode_rival==1) 
    241                 draw_txt_string(30, 4, lang_str(LANG_CONNECT4_HUMAN), TEXT_COLOR); 
     243                draw_txt_string(x, 4, lang_str(LANG_CONNECT4_HUMAN), TEXT_COLOR); 
    242244        else 
    243                 draw_txt_string(30, 4, PLATFORM, TEXT_COLOR); 
     245                draw_txt_string(x, 4, PLATFORM, TEXT_COLOR); 
    244246} 
    245247//------------------------------------------------------------------- 
     
    273275static void move_cursor(int in_x_pos) 
    274276{ 
    275         draw_filled_ellipse((BORDER+((cursor_position)*RECT_SIZE))+15, BORDER+10, 10,10,BG_COLOR); 
     277        draw_filled_ellipse((XBORDER+((cursor_position)*RECT_SIZE))+15, BORDER+10, 10,10,BG_COLOR); 
    276278        if(in_game) 
    277279        { 
     
    288290                        cursor_position=(cursor_position+in_x_pos)%8; 
    289291        } 
    290         draw_filled_ellipse((BORDER+((cursor_position)*RECT_SIZE))+15, BORDER+10, 10,10, (cur_player==1)?P1_COLOR:P2_COLOR); 
     292        draw_filled_ellipse((XBORDER+((cursor_position)*RECT_SIZE))+15, BORDER+10, 10,10, (cur_player==1)?P1_COLOR:P2_COLOR); 
    291293} 
    292294//------------------------------------------------------------------- 
     
    300302        srand(time(NULL)); 
    301303         
    302         draw_filled_rect(0, 0, 360, 240, BG_COLOR);             // draw backgraund 
    303         draw_filled_rect(BORDER, BORDER+BORDER_TOP, BORDER+(7*RECT_SIZE), BORDER+(6*RECT_SIZE)+BORDER_TOP, FIELD_COLOR); 
    304         draw_filled_round_rect(240, 90, 360-BORDER, 240-10, INFO_COLOR); 
    305     draw_txt_string(12, 0, lang_str(LANG_MENU_GAMES_CONNECT4), TEXT_COLOR); 
    306     draw_line(0,15,360,15,0xEF); 
     304        draw_filled_rect(0, 0, screen_width, screen_height, BG_COLOR);          // draw backgraund 
     305        draw_filled_rect(XBORDER, BORDER+BORDER_TOP, XBORDER+(7*RECT_SIZE), BORDER+(6*RECT_SIZE)+BORDER_TOP, FIELD_COLOR); 
     306        draw_filled_round_rect(CAM_TS_BUTTON_BORDER+240, 90, CAM_TS_BUTTON_BORDER+360-BORDER, 240-10, INFO_COLOR); 
     307    draw_txt_string((CAM_TS_BUTTON_BORDER/FONT_WIDTH)+12, 0, lang_str(LANG_MENU_GAMES_CONNECT4), TEXT_COLOR); 
     308    draw_line(CAM_TS_BUTTON_BORDER,15,CAM_TS_BUTTON_BORDER+360,15,COLOR_SPLASH_GREY); 
    307309 
    308310        for(i=0;i<7;i++) 
     
    311313                { 
    312314                        field[i][j+1]=0; 
    313                         draw_filled_ellipse(BORDER+(i*RECT_SIZE)+(RECT_SIZE/2), BORDER+(j*RECT_SIZE)+(RECT_SIZE/2)+BORDER_TOP, 10, 10, BG_COLOR); 
     315                        draw_filled_ellipse(XBORDER+(i*RECT_SIZE)+(RECT_SIZE/2), BORDER+(j*RECT_SIZE)+(RECT_SIZE/2)+BORDER_TOP, 10, 10, BG_COLOR); 
    314316                } 
    315317        } 
     
    320322 
    321323        move_cursor(0); 
    322         draw_txt_string(30, 3, lang_str(LANG_CONNECT4_RIVAL), TEXT_COLOR); 
     324        draw_txt_string((CAM_TS_BUTTON_BORDER/FONT_WIDTH)+30, 3, lang_str(LANG_CONNECT4_RIVAL), TEXT_COLOR); 
    323325    sprintf(str, "%d",count_win[0]); 
    324         draw_txt_string(screen_width/FONT_WIDTH-2-10, screen_height/FONT_HEIGHT-9, str, MAKE_COLOR(INFO_COLOR, P1_COLOR)); 
     326        draw_txt_string((screen_width-CAM_TS_BUTTON_BORDER)/FONT_WIDTH-2-10, screen_height/FONT_HEIGHT-9, str, MAKE_COLOR(INFO_COLOR, P1_COLOR)); 
    325327    sprintf(str, ":"); 
    326         draw_txt_string(screen_width/FONT_WIDTH-2-7, screen_height/FONT_HEIGHT-9, str, INFO_TEXT_COLOR); 
     328        draw_txt_string((screen_width-CAM_TS_BUTTON_BORDER)/FONT_WIDTH-2-7, screen_height/FONT_HEIGHT-9, str, INFO_TEXT_COLOR); 
    327329    sprintf(str, "%d",count_win[1]); 
    328         draw_txt_string(screen_width/FONT_WIDTH-2-4, screen_height/FONT_HEIGHT-9, str, MAKE_COLOR(INFO_COLOR, P2_COLOR)); 
     330        draw_txt_string((screen_width-CAM_TS_BUTTON_BORDER)/FONT_WIDTH-2-4, screen_height/FONT_HEIGHT-9, str, MAKE_COLOR(INFO_COLOR, P2_COLOR)); 
    329331        draw_mode(); 
    330332        if(cur_player==2&&!mode_rival) set(); 
     
    353355  static char str[16]; 
    354356  sprintf(str, "%3d%%", get_batt_perc()); 
    355   draw_txt_string(screen_width/FONT_WIDTH-2-13, screen_height/FONT_HEIGHT-2, str, INFO_TEXT_COLOR); 
    356   gui_osd_draw_clock(300,208,INFO_TEXT_COLOR); 
    357 } 
     357  draw_txt_string((screen_width-CAM_TS_BUTTON_BORDER)/FONT_WIDTH-2-13, screen_height/FONT_HEIGHT-2, str, INFO_TEXT_COLOR); 
     358  gui_osd_draw_clock(CAM_TS_BUTTON_BORDER+290,208,INFO_TEXT_COLOR); 
     359} 
  • trunk/core/gui_calendar.c

    r1024 r1338  
    6363 
    6464    draw_filled_rect(0, 0, screen_width-1, screen_height-1, MAKE_COLOR(SCREEN_COLOR, SCREEN_COLOR)); 
    65     draw_txt_string(1, 0, lang_str(LANG_CALENDAR_TODAY), MAKE_COLOR(SCREEN_COLOR, COLOR_WHITE)); 
     65    draw_txt_string((CAM_TS_BUTTON_BORDER/FONT_WIDTH)+1, 0, lang_str(LANG_CALENDAR_TODAY), MAKE_COLOR(SCREEN_COLOR, COLOR_WHITE)); 
    6666    draw_rect(cal_x-3, cal_y-3, cal_x+cal_w+2, cal_y+cal_h+2, CALENDAR_COLOR); 
    6767    draw_filled_rect(cal_x-1, cal_y-1, cal_x+cal_w, cal_y+FONT_HEIGHT+8, TITLE_COLOR); 
     
    132132    ttm = localtime(&t); 
    133133    sprintf(str, " %2u %s %04u  %2u:%02u:%02u   ", ttm->tm_mday, lang_str(months[ttm->tm_mon]), 1900+ttm->tm_year, ttm->tm_hour, ttm->tm_min, ttm->tm_sec); 
    134     draw_txt_string(8, 0, str, MAKE_COLOR(SCREEN_COLOR, COLOR_WHITE)); 
     134    draw_txt_string((CAM_TS_BUTTON_BORDER/FONT_WIDTH)+8, 0, str, MAKE_COLOR(SCREEN_COLOR, COLOR_WHITE)); 
    135135 
    136136    if (need_redraw) { 
  • trunk/core/gui_draw.c

    r1299 r1338  
    317317    draw_rectangle(x1,y1,x2,y2,cl&0xff,1); 
    318318}  
     319 
     320void draw_round_rect_thick(coord x1, coord y1, coord x2, coord y2, color cl, int thickness) {  
     321    int i; 
     322    cl = cl & 0xff; 
     323    draw_rectangle(x1,y1,x2,y2,cl,1); 
     324    for (i=1; i<thickness; i++) 
     325    { 
     326        draw_rectangle(x1+i,y1+i,x2-i,y2-i,cl,0); 
     327    } 
     328}  
    319329//------------------------------------------------------------------- 
    320330static void fill_rect(color cl) { 
     
    344354void draw_filled_round_rect(coord x1, coord y1, coord x2, coord y2, color cl) {  
    345355    draw_round_rect(x1, y1, x2, y2, cl);  
     356    fill_rect(cl); 
     357}  
     358 
     359void draw_filled_round_rect_thick(coord x1, coord y1, coord x2, coord y2, color cl, int thickness) {  
     360    draw_round_rect_thick(x1, y1, x2, y2, cl, thickness);  
    346361    fill_rect(cl); 
    347362}  
     
    418433#ifdef CAM_DETECT_SCREEN_ERASE 
    419434    draw_set_guard(); 
     435#ifdef CAM_TOUCHSCREEN_UI 
     436    extern int redraw_buttons; 
     437    redraw_buttons = 1; 
     438#endif 
    420439#endif 
    421440} 
  • trunk/core/gui_draw.h

    r1271 r1338  
    208208#define COLOR_BLUE_LT       0x10 
    209209#define COLOR_BLUE          0x14 
    210 #define COLOR_YELLOW        0x16 
     210#define COLOR_YELLOW        0x60 
    211211#define COLOR_BLACK         0xFF 
    212212#define COLOR_BG            0x62 
     
    229229#define COLOR_HISTO_RB_PLAY COLOR_HISTO_RB 
    230230#define COLOR_HISTO_BG_PLAY COLOR_BLUE_LT 
    231 #define COLOR_HISTO_RG_PLAY COLOR_YELLOW 
     231#define COLOR_HISTO_RG_PLAY 0x80 
    232232#undef SCREEN_COLOR 
    233233#define SCREEN_COLOR            0x1D 
     
    366366#define COLOR_HISTO_RG_PLAY COLOR_YELLOW 
    367367 
     368#elif CAM_BITMAP_PALETTE==12    //(IXUS 310) 
     369#define COLOR_TRANSPARENT   0x00 
     370#define COLOR_WHITE         0x01 
     371#define COLOR_RED           0x1e 
     372#define COLOR_GREY          0x1a 
     373#define COLOR_GREEN         0x17 
     374#define COLOR_BLUE_LT       0x10 
     375#define COLOR_BLUE          0x14 
     376#define COLOR_YELLOW        0x74 
     377#define COLOR_BLACK         0xFF 
     378#define COLOR_BG            0x1b 
     379#define COLOR_FG            COLOR_WHITE 
     380#define COLOR_SELECTED_BG   0x0e 
     381#define COLOR_SELECTED_FG   COLOR_BLACK 
     382#define COLOR_ALT_BG        COLOR_BG 
     383#define COLOR_SPLASH_RED    COLOR_RED 
     384#define COLOR_SPLASH_PINK   0x1e                        // Orange 
     385#define COLOR_SPLASH_GREY   0x16 
     386#define COLOR_HISTO_R       0x7a 
     387#define COLOR_HISTO_R_PLAY  0x8f 
     388#define COLOR_HISTO_B       0x7b 
     389#define COLOR_HISTO_B_PLAY  0x90 
     390#define COLOR_HISTO_G       0x7d 
     391#define COLOR_HISTO_G_PLAY      0x91 
     392#define COLOR_HISTO_BG      COLOR_BLUE_LT 
     393#define COLOR_HISTO_RG      COLOR_YELLOW 
     394#define COLOR_HISTO_RB      COLOR_RED 
     395#define COLOR_HISTO_RB_PLAY COLOR_HISTO_RB 
     396#define COLOR_HISTO_BG_PLAY COLOR_BLUE_LT 
     397#define COLOR_HISTO_RG_PLAY 0x85 
     398#undef SCREEN_COLOR 
     399#define SCREEN_COLOR            0x1D 
     400 
    368401#else 
    369402#error CAM_BITMAP_PALETTE not defined 
     
    398431extern void draw_rect_shadow(coord x1, coord y1, coord x2, coord y2, color cl, int thickness); 
    399432extern void draw_round_rect(coord x1, coord y1, coord x2, coord y2, color cl); 
     433extern void draw_round_rect_thick(coord x1, coord y1, coord x2, coord y2, color cl, int thickness); 
    400434// color: hi_byte - BG; lo_byte - FG 
    401435extern void draw_filled_rect(coord x1, coord y1, coord x2, coord y2, color cl); 
    402436extern void draw_filled_rect_thick(coord x1, coord y1, coord x2, coord y2, color cl, int thickness); 
    403437extern void draw_filled_round_rect(coord x1, coord y1, coord x2, coord y2, color cl); 
     438extern void draw_filled_round_rect_thick(coord x1, coord y1, coord x2, coord y2, color cl, int thickness); 
    404439 
    405440extern void draw_char(coord x, coord y, const char ch, color cl); 
  • trunk/core/gui_lang.c

    r1045 r1338  
    583583"460 \"You need to be in REC-mode\\nfor this operation.\"\n" 
    584584"461 \"%s disabled in build\"\n" 
     585 
     586// Touch screen 
     587"462 \"Touchscreen overrides\"\n" 
     588"463 \"Video AE Controls\"\n" 
     589"464 \"<Alt> Shortcut Buttons\"\n" 
    585590; 
    586591 
  • trunk/core/gui_lang.h

    r1045 r1338  
    571571#define LANG_MENU_BADPIXEL_CREATE  459 
    572572#define LANG_MSG_RECMODE_REQUIRED  460 
    573 #define LANG_CONSOLE_SCRIPT_DISABLED_IN_BUILD  461 
     573#define LANG_CONSOLE_SCRIPT_DISABLED_IN_BUILD 461 
    574574//------------------------------------------------------------------- 
    575  
    576 #define GUI_LANG_ITEMS                  461 
     575// Touch screen 
     576#define LANG_MENU_TOUCHSCREEN_VALUES        462 
     577#define LANG_MENU_TS_VIDEO_AE_DISABLE       463 
     578#define LANG_MENU_TS_ALT_SHORTCUTS_DISABLE  464 
     579//------------------------------------------------------------------- 
     580 
     581#define GUI_LANG_ITEMS                  464 
    577582 
    578583//------------------------------------------------------------------- 
  • trunk/core/gui_mastermind.c

    r1323 r1338  
    2121int curr_y; 
    2222int answer[4]; 
    23 char colors[6]; 
     23char colors[6] = { COLOR_HISTO_R_PLAY, COLOR_HISTO_G_PLAY, COLOR_HISTO_B_PLAY, COLOR_YELLOW, COLOR_WHITE, COLOR_BLACK }; 
    2424int curr_color[4]; 
    2525int GameGo; 
    2626static char buf[128]; 
    2727 
     28static void guess_box(int pos, color col) 
     29{ 
     30        draw_filled_rect(CAM_TS_BUTTON_BORDER+100+(pos*10), BORDER+(2*curr_y*10)+2+2*curr_y, CAM_TS_BUTTON_BORDER+100+(pos*10)+6, BORDER+(2*curr_y*10)+8+2*curr_y , MAKE_COLOR(col,col)); 
     31} 
     32 
    2833char WinQuary(){ 
    2934        char pos=0; 
    30         int i=0; 
    31          
    32         for(i=0;i<4;i++){ 
    33                 if(answer[i]==curr_color[i]){ 
    34                         draw_filled_rect(100+(pos*10), BORDER+(2*curr_y*10)+2+2*curr_y, 100+(pos*10)+6, BORDER+(2*curr_y*10)+8+2*curr_y , MAKE_COLOR(COLOR_BLACK,COLOR_BLACK)); 
     35        int i, j; 
     36         
     37        for (i=0; i<4; i++) 
     38    { 
     39                if (answer[i] == curr_color[i]) 
     40        { 
     41            guess_box(pos,COLOR_BLACK); 
    3542                        pos++; 
    3643                } 
    3744        } 
    3845         
    39         if(pos==4){ 
    40                 GameGo=0; 
     46        if (pos == 4) 
     47    { 
     48                GameGo = 0; 
    4149                return 1; 
    4250        } 
    4351         
    44         if(answer[0]==curr_color[1] || answer[0]==curr_color[2] || answer[0]==curr_color[3]){ 
    45                 draw_filled_rect(100+(pos*10), BORDER+(2*curr_y*10)+2+2*curr_y, 100+(pos*10)+6, BORDER+(2*curr_y*10)+8+2*curr_y , MAKE_COLOR(COLOR_WHITE,COLOR_WHITE)); 
    46                 pos++; 
    47         } 
    48         if(answer[1]==curr_color[0] || answer[1]==curr_color[2] || answer[1]==curr_color[3]){ 
    49                 draw_filled_rect(100+(pos*10), BORDER+(2*curr_y*10)+2+2*curr_y, 100+(pos*10)+6, BORDER+(2*curr_y*10)+8+2*curr_y , MAKE_COLOR(COLOR_WHITE,COLOR_WHITE)); 
    50                 pos++; 
    51         } 
    52         if(answer[2]==curr_color[0] || answer[2]==curr_color[1] || answer[2]==curr_color[3]){ 
    53                 draw_filled_rect(100+(pos*10), BORDER+(2*curr_y*10)+2+2*curr_y, 100+(pos*10)+6, BORDER+(2*curr_y*10)+8+2*curr_y , MAKE_COLOR(COLOR_WHITE,COLOR_WHITE)); 
    54                 pos++; 
    55         } 
    56         if(answer[3]==curr_color[0] || answer[3]==curr_color[1] || answer[3]==curr_color[2]){ 
    57                 draw_filled_rect(100+(pos*10), BORDER+(2*curr_y*10)+2+2*curr_y, 100+(pos*10)+6, BORDER+(2*curr_y*10)+8+2*curr_y , MAKE_COLOR(COLOR_WHITE,COLOR_WHITE)); 
    58                 pos++; 
    59         } 
    60  
    61         if(curr_y==0){ 
    62                 GameGo=0; 
     52        for (i=0; i<4; i++) 
     53    { 
     54        for (j=0; j<4; j++) 
     55        { 
     56                    if ((answer[i] == curr_color[j]) && (i != j)) 
     57            { 
     58                guess_box(pos,COLOR_WHITE); 
     59                            pos++; 
     60            } 
     61                } 
     62        } 
     63 
     64        if(curr_y==0) 
     65    { 
     66                GameGo = 0; 
    6367                return 2; 
    6468        } 
     69 
    6570        return 0; 
    6671} 
    6772 
    6873char CanNext(){ 
    69         if(curr_color[0]==99 || curr_color[1]==99 || curr_color[2]==99 || curr_color[3]==99) 
     74        if (curr_color[0]==99 || curr_color[1]==99 || curr_color[2]==99 || curr_color[3]==99) 
    7075                return 0; 
    71         else if(curr_color[0]==curr_color[1] || curr_color[0]==curr_color[2] || curr_color[0]==curr_color[3] || 
    72                 curr_color[1]==curr_color[2] || curr_color[1]==curr_color[3] || curr_color[2]==curr_color[3]){ 
    73                 draw_string(167, 130 , lang_str(LANG_MENU_GAMES_DCOLOR), TEXT_COLOR); 
     76        else if (curr_color[0]==curr_color[1] || curr_color[0]==curr_color[2] || curr_color[0]==curr_color[3] || 
     77                     curr_color[1]==curr_color[2] || curr_color[1]==curr_color[3] || curr_color[2]==curr_color[3]) 
     78    { 
     79                draw_string(CAM_TS_BUTTON_BORDER+167, 130, lang_str(LANG_MENU_GAMES_DCOLOR), TEXT_COLOR); 
    7480                return 0; 
    7581        } 
     
    8187        int i=0; 
    8288         
    83         for(i=0;i<4;i++)answer[i]=99; 
    84         i=0; 
    85         while(i<4){ 
    86                 tmp=rand()%6; 
    87                 if(answer[0]!=tmp && answer[1]!=tmp && answer[2]!=tmp && answer[3]!=tmp){ 
    88                         answer[i]=tmp; 
     89        for (i=0; i<4; i++) answer[i] = 99; 
     90        i = 0; 
     91        while (i<4) 
     92    { 
     93                tmp = rand() % 6; 
     94                if (answer[0]!=tmp && answer[1]!=tmp && answer[2]!=tmp && answer[3]!=tmp) 
     95        { 
     96                        answer[i] = tmp; 
    8997                        i++; 
    9098                } 
    9199        } 
    92          
    93         //for (i=0; i<4;i++) 
    94         //      draw_filled_rect(BORDER+(2*i*10), 213, BORDER+(2*i*10)+10,223, MAKE_COLOR(colors[answer[i]],colors[answer[i]])); 
    95  
    96100} 
    97101 
    98102int gui_mastermind_init() { 
    99103        int i,j; 
    100         colors[0]=COLOR_HISTO_R_PLAY; 
    101         colors[1]=COLOR_HISTO_G_PLAY; 
    102         colors[2]=COLOR_HISTO_B_PLAY; 
    103         colors[3]=COLOR_YELLOW; 
    104         colors[4]=COLOR_WHITE; 
    105         colors[5]=COLOR_BLACK; 
    106         curr_color[0]=0; 
    107         curr_color[1]=0; 
    108         curr_color[2]=0; 
    109         curr_color[3]=0; 
    110104 
    111105        curr_x=0; 
    112106        curr_y=7; 
    113107         
    114         draw_filled_rect( 0, 0, 360, 240, BG_COLOR); 
    115  
    116         for (i=0;i<4;i++){ 
    117                 for (j=0;j<8;j++){ 
    118                         draw_filled_rect(BORDER+(2*i*10), BORDER+(2*j*10)+2*j, BORDER+(2*i*10)+10, BORDER+(2*j*10)+2*j+10 , COLOR_LIGHT_GRAY); 
    119                 } 
    120         } 
    121  
    122         draw_filled_rect(10, BORDER+(2*j*10)+2*j, 150,BORDER+(2*j*10)+2*j+1, MAKE_COLOR(BG_COLOR,COLOR_WHITE)); 
    123         draw_filled_rect(148, 10, 149,230, MAKE_COLOR(BG_COLOR,COLOR_WHITE)); 
    124         draw_filled_rect(151, 10, 152,230, MAKE_COLOR(BG_COLOR,COLOR_WHITE)); 
    125          
    126         //for (i=0; i<4;i++) 
    127         //      draw_filled_rect(BORDER+(2*i*10), 213, BORDER+(2*i*10)+10,223, COLOR_LIGHT_GRAY); 
     108        draw_filled_rect( 0, 0, screen_width-1, screen_height-1, BG_COLOR); 
     109 
     110        for (i=0;i<4;i++) 
     111                for (j=0;j<8;j++) 
     112                        draw_filled_rect(CAM_TS_BUTTON_BORDER+BORDER+(2*i*10), BORDER+(2*j*10)+2*j, CAM_TS_BUTTON_BORDER+BORDER+(2*i*10)+10, BORDER+(2*j*10)+2*j+10 , COLOR_LIGHT_GRAY); 
     113 
     114        draw_filled_rect(CAM_TS_BUTTON_BORDER+10, BORDER+(2*j*10)+2*j, CAM_TS_BUTTON_BORDER+150,BORDER+(2*j*10)+2*j+1, MAKE_COLOR(BG_COLOR,COLOR_WHITE)); 
     115        draw_filled_rect(CAM_TS_BUTTON_BORDER+148, 10, CAM_TS_BUTTON_BORDER+149,230, MAKE_COLOR(BG_COLOR,COLOR_WHITE)); 
     116        draw_filled_rect(CAM_TS_BUTTON_BORDER+151, 10, CAM_TS_BUTTON_BORDER+152,230, MAKE_COLOR(BG_COLOR,COLOR_WHITE)); 
    128117         
    129118        for (i=0; i<6;i++) 
    130                 draw_filled_rect(BORDER+(2*(i+7)*10)+20, 40, BORDER+(2*(i+7)*10)+35,55, MAKE_COLOR(colors[i],colors[i])); 
     119                draw_filled_rect(CAM_TS_BUTTON_BORDER+BORDER+(2*(i+7)*10)+20, 40, CAM_TS_BUTTON_BORDER+BORDER+(2*(i+7)*10)+35,55, MAKE_COLOR(colors[i],colors[i])); 
    131120                 
    132         draw_filled_rect(BORDER+(2*7*10)+20, 65, BORDER+(2*7*10)+35,80, MAKE_COLOR(COLOR_BLACK,COLOR_BLACK)); 
    133         draw_string(BORDER+(2*7*10)+50, 65 , lang_str(LANG_MENU_GAMES_RIGHT_PLACE), TEXT_COLOR); 
    134          
    135         draw_filled_rect(BORDER+(2*7*10)+20, 90, BORDER+(2*7*10)+35,105, MAKE_COLOR(COLOR_WHITE,COLOR_WHITE)); 
    136         draw_string(BORDER+(2*7*10)+50, 90 , lang_str(LANG_MENU_GAMES_C_IN_ANSWER), TEXT_COLOR); 
    137  
     121        draw_filled_rect(CAM_TS_BUTTON_BORDER+BORDER+(2*7*10)+20, 65, CAM_TS_BUTTON_BORDER+BORDER+(2*7*10)+35,80, MAKE_COLOR(COLOR_BLACK,COLOR_BLACK)); 
     122        draw_string(CAM_TS_BUTTON_BORDER+BORDER+(2*7*10)+50, 65 , lang_str(LANG_MENU_GAMES_RIGHT_PLACE), TEXT_COLOR); 
     123         
     124        draw_filled_rect(CAM_TS_BUTTON_BORDER+BORDER+(2*7*10)+20, 90, CAM_TS_BUTTON_BORDER+BORDER+(2*7*10)+35,105, MAKE_COLOR(COLOR_WHITE,COLOR_WHITE)); 
     125        draw_string(CAM_TS_BUTTON_BORDER+BORDER+(2*7*10)+50, 90 , lang_str(LANG_MENU_GAMES_C_IN_ANSWER), TEXT_COLOR); 
    138126                                         
    139         draw_string(173, 20 , lang_str(LANG_MENU_GAMES_AC_COLORS), TEXT_COLOR); 
     127        draw_string(CAM_TS_BUTTON_BORDER+173, 20 , lang_str(LANG_MENU_GAMES_AC_COLORS), TEXT_COLOR); 
    140128                 
    141         draw_string(167, 200 , lang_str(LANG_MENU_GAMES_CURSOR1), TEXT_COLOR); 
    142         draw_string(167, 185 , lang_str(LANG_MENU_GAMES_CURSOR2), TEXT_COLOR); 
    143         draw_string(167, 170 , lang_str(LANG_MENU_GAMES_CURSOR3), TEXT_COLOR); 
     129        draw_string(CAM_TS_BUTTON_BORDER+167, 200 , lang_str(LANG_MENU_GAMES_CURSOR1), TEXT_COLOR); 
     130        draw_string(CAM_TS_BUTTON_BORDER+167, 185 , lang_str(LANG_MENU_GAMES_CURSOR2), TEXT_COLOR); 
     131        draw_string(CAM_TS_BUTTON_BORDER+167, 170 , lang_str(LANG_MENU_GAMES_CURSOR3), TEXT_COLOR); 
    144132 
    145133        for(i=0;i<4;i++) curr_color[i]=99; 
     
    148136} 
    149137//------------------------------------------------------------------- 
     138static void draw_box(color border) 
     139{ 
     140    if (curr_color[curr_x] == 99) curr_color[curr_x] = 0; 
     141    draw_filled_rect(CAM_TS_BUTTON_BORDER+BORDER+(2*curr_x*10), BORDER+(2*curr_y*10)+2*curr_y, CAM_TS_BUTTON_BORDER+BORDER+(2*curr_x*10)+10, BORDER+(2*curr_y*10)+2*curr_y+10 , MAKE_COLOR(colors[curr_color[curr_x]],border)); 
     142} 
     143 
     144static void end_game(int msg) 
     145{ 
     146    int i; 
     147    draw_string(CAM_TS_BUTTON_BORDER+198, 130 , lang_str(msg), TEXT_COLOR); 
     148        for (i=0; i<4;i++) 
     149            draw_filled_rect(CAM_TS_BUTTON_BORDER+BORDER+(2*i*10), 213, CAM_TS_BUTTON_BORDER+BORDER+(2*i*10)+10,223,  MAKE_COLOR(colors[answer[i]],colors[answer[i]])); 
     150} 
     151 
     152static void chg_box(int inc_box, int inc_val) 
     153{ 
     154    draw_box(colors[curr_color[curr_x]]); 
     155    curr_x = (curr_x + inc_box) & 3; 
     156    if (curr_color[curr_x] == 99) curr_color[curr_x] = 0; 
     157    curr_color[curr_x] = (curr_color[curr_x] + inc_val); 
     158    if (curr_color[curr_x] < 0) curr_color[curr_x] = 5; 
     159    else if (curr_color[curr_x] > 5) curr_color[curr_x] = 0; 
     160    draw_box(COLOR_BLACK); 
     161} 
     162 
    150163void gui_mastermind_kbd_process() { 
    151164        int i=0; 
    152165        rand(); 
    153         switch (kbd_get_autoclicked_key())  
    154         { 
    155                 case KEY_SET: 
    156                         if(GameGo==1){ 
    157                                 if(CanNext()){ 
    158                                         if(WinQuary()==1){ 
    159                                                 draw_string(198, 130 , lang_str(LANG_MENU_GAMES_RIGHT), TEXT_COLOR); 
    160                                                 draw_string(167, 200 , lang_str(LANG_MENU_GAMES_CURSOR1), TEXT_COLOR); 
    161                                                 draw_string(167, 185 , lang_str(LANG_MENU_GAMES_CURSOR2), TEXT_COLOR); 
    162                                                 draw_string(167, 170 , lang_str(LANG_MENU_GAMES_CURSOR3), TEXT_COLOR); 
    163                                                 for (i=0; i<4;i++) 
    164                                                         draw_filled_rect(BORDER+(2*i*10), 213, BORDER+(2*i*10)+10,223,  MAKE_COLOR(colors[answer[i]],colors[answer[i]])); 
    165                                         } 
    166                                         else if(WinQuary()==2){ 
    167                                                 draw_string(198, 130 , lang_str(LANG_MENU_GAMES_GAME_OVER), TEXT_COLOR); 
    168                                                 draw_string(167, 200 , lang_str(LANG_MENU_GAMES_CURSOR1), TEXT_COLOR); 
    169                                                 draw_string(167, 185 , lang_str(LANG_MENU_GAMES_CURSOR2), TEXT_COLOR); 
    170                                                 draw_string(167, 170 , lang_str(LANG_MENU_GAMES_CURSOR3), TEXT_COLOR); 
    171                                                 for (i=0; i<4;i++) 
    172                                                         draw_filled_rect(BORDER+(2*i*10), 213, BORDER+(2*i*10)+10,223,  MAKE_COLOR(colors[answer[i]],colors[answer[i]])); 
    173                                         } 
    174                                         else{ 
    175                                                 draw_filled_rect(BORDER+(2*(curr_x)*10), BORDER+(2*curr_y*10)+2*curr_y, BORDER+(2*(curr_x)*10)+10, BORDER+(2*curr_y*10)+2*curr_y+10 , MAKE_COLOR(colors[curr_color[curr_x]],colors[curr_color[curr_x]])); 
    176                                                 for(i=0;i<4;i++) curr_color[i]=99; 
    177                                                 curr_y--; 
    178                                                 curr_x=0; 
    179                                                 if(curr_color[curr_x]==99) curr_color[curr_x]=0; 
    180                                                 draw_filled_rect(BORDER+(2*curr_x*10), BORDER+(2*curr_y*10)+2*curr_y, BORDER+(2*curr_x*10)+10, BORDER+(2*curr_y*10)+2*curr_y+10 , MAKE_COLOR(colors[curr_color[curr_x]],COLOR_BLACK)); 
    181                                         } 
    182                                 } 
    183                         } 
    184                         else{ 
    185                                 gui_mastermind_init(); 
    186                                 CreateColorCombo(); 
    187                                 for (i=0; i<4;i++)draw_filled_rect(BORDER+(2*i*10), 213, BORDER+(2*i*10)+10,223, BG_COLOR); // overwrite anwser 
    188                                 curr_x=0; 
    189                                 if(curr_color[curr_x]==99) curr_color[curr_x]=0; 
    190                                 draw_filled_rect(BORDER+(2*curr_x*10), BORDER+(2*curr_y*10)+2*curr_y, BORDER+(2*curr_x*10)+10, BORDER+(2*curr_y*10)+2*curr_y+10 , MAKE_COLOR(colors[curr_color[curr_x]],COLOR_BLACK)); 
    191                                 GameGo=1; 
    192                                 draw_string(198, 130 , "            ", TEXT_COLOR); 
    193                         } 
    194                         break; 
    195                 case KEY_LEFT: 
    196                         if(GameGo==1){ 
    197                                 draw_filled_rect(BORDER+(2*curr_x*10), BORDER+(2*curr_y*10)+2*curr_y, BORDER+(2*curr_x*10)+10, BORDER+(2*curr_y*10)+2*curr_y+10 , MAKE_COLOR(colors[curr_color[curr_x]],colors[curr_color[curr_x]])); 
    198                                 (curr_x==0)?curr_x=3:curr_x--; 
    199                                 if(curr_color[curr_x]==99) curr_color[curr_x]=0; 
    200                                 draw_filled_rect(BORDER+(2*curr_x*10), BORDER+(2*curr_y*10)+2*curr_y, BORDER+(2*curr_x*10)+10, BORDER+(2*curr_y*10)+2*curr_y+10 , MAKE_COLOR(colors[curr_color[curr_x]],COLOR_BLACK)); 
    201                         } 
    202                         break; 
    203                 case KEY_RIGHT: 
    204                         if(GameGo==1){ 
    205                                 draw_filled_rect(BORDER+(2*curr_x*10), BORDER+(2*curr_y*10)+2*curr_y, BORDER+(2*curr_x*10)+10, BORDER+(2*curr_y*10)+2*curr_y+10 , MAKE_COLOR(colors[curr_color[curr_x]],colors[curr_color[curr_x]])); 
    206                                 curr_x=(curr_x+1)%4; 
    207                                 if(curr_color[curr_x]==99) curr_color[curr_x]=0; 
    208                                 draw_filled_rect(BORDER+(2*curr_x*10), BORDER+(2*curr_y*10)+2*curr_y, BORDER+(2*curr_x*10)+10, BORDER+(2*curr_y*10)+2*curr_y+10 , MAKE_COLOR(colors[curr_color[curr_x]],COLOR_BLACK)); 
    209                         } 
    210                         break; 
    211                 case KEY_UP: 
    212                         if(GameGo==1){ 
    213                                 draw_string(167, 130 , "                       ", TEXT_COLOR); 
    214                                 curr_color[curr_x]=(curr_color[curr_x]+1)%6; 
    215                                 draw_filled_rect(BORDER+(2*curr_x*10), BORDER+(2*curr_y*10)+2*curr_y, BORDER+(2*curr_x*10)+10, BORDER+(2*curr_y*10)+2*curr_y+10 , MAKE_COLOR(colors[curr_color[curr_x]],COLOR_BLACK)); 
    216                         } 
    217                         break; 
    218                 case KEY_DOWN: 
    219                         if(GameGo==1){ 
    220                                 draw_string(167, 130 , "                       ", TEXT_COLOR); 
    221                                 (curr_color[curr_x]-1<0)?curr_color[curr_x]=5:curr_color[curr_x]--; 
    222                                 draw_filled_rect(BORDER+(2*curr_x*10), BORDER+(2*curr_y*10)+2*curr_y, BORDER+(2*curr_x*10)+10, BORDER+(2*curr_y*10)+2*curr_y+10 , MAKE_COLOR(colors[curr_color[curr_x]],COLOR_BLACK)); 
    223                         } 
    224                         break; 
    225         } 
     166    long key = kbd_get_autoclicked_key(); 
     167    if (key) 
     168    { 
     169        if (GameGo == 1) 
     170        { 
     171            draw_string(CAM_TS_BUTTON_BORDER+167, 130 , "                       ", TEXT_COLOR); 
     172                switch (kbd_get_autoclicked_key())  
     173                { 
     174                        case KEY_SET: 
     175                                if(CanNext()) 
     176                    { 
     177                                        if(WinQuary() == 1) 
     178                        { 
     179                            end_game(LANG_MENU_GAMES_RIGHT); 
     180                                        } 
     181                                        else if(WinQuary() == 2) 
     182                        { 
     183                            end_game(LANG_MENU_GAMES_GAME_OVER); 
     184                                        } 
     185                                        else 
     186                        { 
     187                            draw_box(colors[curr_color[curr_x]]); 
     188                                                for(i=0;i<4;i++) curr_color[i]=99; 
     189                                                curr_y--; 
     190                                                curr_x=0; 
     191                            draw_box(COLOR_BLACK); 
     192                                        } 
     193                                } 
     194                                break; 
     195                        case KEY_LEFT: 
     196                    chg_box(-1,0); 
     197                                break; 
     198                        case KEY_RIGHT: 
     199                    chg_box(1,0); 
     200                                break; 
     201                        case KEY_UP: 
     202                    chg_box(0,1); 
     203                                break; 
     204                        case KEY_DOWN: 
     205                    chg_box(0,-1); 
     206                                break; 
     207                } 
     208        } 
     209        else if (key == KEY_SET) 
     210        { 
     211                        gui_mastermind_init(); 
     212                        CreateColorCombo(); 
     213            draw_box(COLOR_BLACK); 
     214                        GameGo=1; 
     215        } 
     216    } 
    226217} 
    227218//------------------------------------------------------------------- 
     
    230221    static struct tm *ttm; 
    231222 
    232     draw_txt_string(15, 0, lang_str(LANG_MENU_GAMES_MASTERMIND), MAKE_COLOR(BG_COLOR, COLOR_WHITE)); 
     223    draw_txt_string(CAM_TS_BUTTON_BORDER/FONT_WIDTH+15, 0, lang_str(LANG_MENU_GAMES_MASTERMIND), MAKE_COLOR(BG_COLOR, COLOR_WHITE)); 
    233224 
    234225    t = time(NULL); 
    235226    ttm = localtime(&t); 
    236     sprintf(buf, "Time: %2u:%02u", ttm->tm_hour, ttm->tm_min); 
    237     draw_txt_string(screen_width/FONT_WIDTH-2-1-1-9-2-5-4, screen_height/FONT_HEIGHT-1, buf, TEXT_COLOR); 
    238          
    239         sprintf(buf, "Batt:%3d%%", get_batt_perc()); 
    240     draw_txt_string(screen_width/FONT_WIDTH-2-9, screen_height/FONT_HEIGHT-1, buf, TEXT_COLOR); 
    241 } 
     227    sprintf(buf, "Time: %2u:%02u  Batt:%3d%%", ttm->tm_hour, ttm->tm_min, get_batt_perc()); 
     228    draw_txt_string((screen_width-CAM_TS_BUTTON_BORDER)/FONT_WIDTH-2-1-1-9-2-5-4, screen_height/FONT_HEIGHT-1, buf, TEXT_COLOR); 
     229} 
  • trunk/core/gui_palette.c

    r1234 r1338  
    6565 
    6666void gui_palette_draw() { 
    67     unsigned int x, y; 
     67    unsigned int x, y, xl, xr; 
    6868    char f=0; 
    6969    color c; 
    7070    static char buf[64]; 
    7171 
     72    xl = CAM_TS_BUTTON_BORDER; 
     73    xr = screen_width - CAM_TS_BUTTON_BORDER; 
     74 
    7275    if (gui_palette_redraw) 
    7376    { 
    7477        // Draw top text line - current color + instructions 
    75         draw_string(screen_width-29*FONT_WIDTH, 0, "    Use \x18\x19\x1b\x1a to change color ", MAKE_COLOR(COLOR_BLACK, COLOR_WHITE)); 
     78        draw_string(xr-29*FONT_WIDTH, 0, "    Use \x18\x19\x1b\x1a to change color ", MAKE_COLOR(COLOR_BLACK, COLOR_WHITE)); 
    7679        sprintf(buf, " %s: 0x%02hX    ", lang_str(LANG_PALETTE_TEXT_COLOR), (unsigned char)cl); 
    77         draw_txt_string(0, 0, buf, MAKE_COLOR(COLOR_BLACK, COLOR_WHITE)); 
     80        draw_string(xl, 0, buf, MAKE_COLOR(COLOR_BLACK, COLOR_WHITE)); 
    7881 
    7982        // Draw Palette color boxes 
     
    8386            for (x=DISP_LEFT; x<DISP_RIGHT; x+=CELL_SIZE, c+=0x0100) 
    8487            { 
    85                 draw_filled_rect(x, y, x+CELL_SIZE, y+CELL_SIZE, c); 
     88                draw_filled_rect(xl+x, y, xl+x+CELL_SIZE, y+CELL_SIZE, c); 
    8689            } 
    8790        } 
    8891 
    8992        // Draw gray borders 
    90         draw_rect_thick(0, DISP_TOP-BORDER_SIZE, screen_width-1, screen_height-1, COLOR_GREY, BORDER_SIZE); // outer border 
    91         draw_filled_rect(DISP_RIGHT+1, DISP_TOP, DISP_RIGHT+BORDER_SIZE, DISP_BOTTOM, MAKE_COLOR(COLOR_GREY, COLOR_GREY)); //middle 
     93        draw_rect_thick(xl, DISP_TOP-BORDER_SIZE, xr-1, screen_height-1, COLOR_GREY, BORDER_SIZE); // outer border 
     94        draw_filled_rect(xl+DISP_RIGHT+1, DISP_TOP, xl+DISP_RIGHT+BORDER_SIZE, DISP_BOTTOM, MAKE_COLOR(COLOR_GREY, COLOR_GREY)); //middle 
    9295 
    93         // Co-ordintate of selected color 
     96        // Co-ordinate of selected color 
    9497        y = DISP_TOP + ((cl>>4)&0x0F) * CELL_SIZE; 
    9598        x = DISP_LEFT + (cl&0x0F) * CELL_SIZE; 
    9699 
    97100        // Highlight selected color 
    98         draw_filled_rect_thick(x-CELL_ZOOM, y-CELL_ZOOM, x+CELL_SIZE+CELL_ZOOM, y+CELL_SIZE+CELL_ZOOM, MAKE_COLOR(cl, COLOR_RED), 2); 
     101        draw_filled_rect_thick(xl+x-CELL_ZOOM, y-CELL_ZOOM, xl+x+CELL_SIZE+CELL_ZOOM, y+CELL_SIZE+CELL_ZOOM, MAKE_COLOR(cl, COLOR_RED), 2); 
    99102 
    100103        // Fill 'sample' area with selected color 
    101         draw_filled_rect(DISP_RIGHT+BORDER_SIZE+1, DISP_TOP, screen_width-BORDER_SIZE-1, DISP_BOTTOM, MAKE_COLOR(cl, COLOR_WHITE)); 
     104        draw_filled_rect(xl+DISP_RIGHT+BORDER_SIZE+1, DISP_TOP, xr-BORDER_SIZE-1, DISP_BOTTOM, MAKE_COLOR(cl, COLOR_WHITE)); 
    102105 
    103106        gui_palette_redraw = 0; 
  • trunk/core/gui_read.c

    r547 r1338  
    2626static void gui_read_draw_batt() { 
    2727    sprintf(buffer, "Batt:%3d%%", get_batt_perc()); 
    28     draw_txt_string(screen_width/FONT_WIDTH-2-1-1-9, 0, buffer, MAKE_COLOR(COLOR_BLACK, COLOR_WHITE)); 
     28    draw_txt_string((screen_width-CAM_TS_BUTTON_BORDER)/FONT_WIDTH-2-1-1-9, 0, buffer, MAKE_COLOR(COLOR_BLACK, COLOR_WHITE)); 
    2929} 
    3030 
     
    3737    ttm = localtime(&t); 
    3838    sprintf(buffer, "%2u:%02u", ttm->tm_hour, ttm->tm_min); 
    39     draw_txt_string(screen_width/FONT_WIDTH-2-1-1-9-2-5, 0, buffer, MAKE_COLOR(COLOR_BLACK, COLOR_WHITE)); 
     39    draw_txt_string((screen_width-CAM_TS_BUTTON_BORDER)/FONT_WIDTH-2-1-1-9-2-5, 0, buffer, MAKE_COLOR(COLOR_BLACK, COLOR_WHITE)); 
    4040} 
    4141 
    4242//------------------------------------------------------------------- 
    4343static void gui_read_draw_scroll_indicator() { 
    44     draw_txt_char(screen_width/FONT_WIDTH-2, 0, (conf.reader_autoscroll)?((pause)?'\x05':'\x04'):'\x03', MAKE_COLOR(COLOR_BLACK, COLOR_WHITE)); //title infoline 
     44    draw_txt_char((screen_width-CAM_TS_BUTTON_BORDER)/FONT_WIDTH-2, 0, (conf.reader_autoscroll)?((pause)?'\x05':'\x04'):'\x03', MAKE_COLOR(COLOR_BLACK, COLOR_WHITE)); //title infoline 
    4545} 
    4646 
     
    6060    pause = 0; 
    6161    read_to_draw = 1; 
    62     x=6;  
     62    x=CAM_TS_BUTTON_BORDER+6;  
    6363    y=FONT_HEIGHT; 
    64     w=screen_width-6-6-8; 
     64    w=screen_width-CAM_TS_BUTTON_BORDER*2-6-6-8; 
    6565    h=screen_height-y; 
    6666    last_time = get_tick_count(); 
     
    167167        sprintf(buffer, "(%3d%%) %d/%d  ", (read_file_size)?(conf.reader_pos*100/read_file_size):0, conf.reader_pos, read_file_size); 
    168168        buffer[screen_width/FONT_WIDTH]=0; 
    169         draw_txt_string(0, 0, buffer, MAKE_COLOR(COLOR_BLACK, COLOR_WHITE)); //title infoline 
     169        draw_txt_string((CAM_TS_BUTTON_BORDER/FONT_WIDTH), 0, buffer, MAKE_COLOR(COLOR_BLACK, COLOR_WHITE)); //title infoline 
    170170 
    171171        // scrollbar 
  • trunk/core/gui_reversi.c

    r1323 r1338  
    220220 
    221221    field_size = (screen_height-2*FONT_HEIGHT-4)&0xFFF8; 
    222     field_x = FONT_WIDTH+8; 
     222    field_x = CAM_TS_BUTTON_BORDER+FONT_WIDTH+8; 
    223223    field_y = (screen_height-field_size)>>1; 
    224224    cell_size = field_size >> 3; 
     
    322322//------------------------------------------------------------------- 
    323323static void redrawstatus() { 
    324     uchar x=field_size+FONT_WIDTH*2+23, y = 25; 
     324    int x=CAM_TS_BUTTON_BORDER+field_size+FONT_WIDTH*2+23, y = 25; 
    325325    if (InGame) {  
    326326        if (CurrPlayer==FIELD_PLAYER1) {  
     
    410410 
    411411    sprintf(buf, "Batt:%3d%%", get_batt_perc()); 
    412     draw_txt_string(screen_width/FONT_WIDTH-2-9, screen_height/FONT_HEIGHT-1, buf, MAKE_COLOR(SCREEN_COLOR, COLOR_WHITE)); 
     412    draw_txt_string((screen_width-CAM_TS_BUTTON_BORDER)/FONT_WIDTH-2-9, screen_height/FONT_HEIGHT-1, buf, MAKE_COLOR(SCREEN_COLOR, COLOR_WHITE)); 
    413413 
    414414    Timer(); 
  • trunk/core/gui_sokoban.c

    r1323 r1338  
    4848 
    4949static int need_redraw; 
     50static int need_redraw_all; 
    5051static int  moves; 
    5152static char field[FIELD_HEIGHT][FIELD_WIDTH]; 
     
    216217    if (++conf.sokoban_level >= num_levels) conf.sokoban_level = 0; 
    217218    sokoban_set_level(conf.sokoban_level); 
    218     need_redraw = 1; 
     219    need_redraw_all = 1; 
    219220} 
    220221 
     
    249250//------------------------------------------------------------------- 
    250251static void sokoban_draw_box(int x, int y, color cl) { 
    251     draw_filled_rect(x*cell_size, y*cell_size, x*cell_size+cell_size-1, y*cell_size+cell_size-1, cl); 
    252     draw_line(x*cell_size+2, y*cell_size, x*cell_size+2, y*cell_size+cell_size-1, cl); 
    253     draw_line(x*cell_size+cell_size-1-2, y*cell_size, x*cell_size+cell_size-1-2, y*cell_size+cell_size-1, cl); 
    254     draw_line(x*cell_size+2, y*cell_size+2, x*cell_size+cell_size-1-2, y*cell_size+2, cl); 
    255     draw_line(x*cell_size+2, y*cell_size+cell_size-1-2, x*cell_size+cell_size-1-2, y*cell_size+cell_size-1-2, cl); 
     252    draw_filled_rect(CAM_TS_BUTTON_BORDER+x*cell_size, y*cell_size, CAM_TS_BUTTON_BORDER+x*cell_size+cell_size-1, y*cell_size+cell_size-1, cl); 
     253    draw_line(CAM_TS_BUTTON_BORDER+x*cell_size+2, y*cell_size, CAM_TS_BUTTON_BORDER+x*cell_size+2, y*cell_size+cell_size-1, cl); 
     254    draw_line(CAM_TS_BUTTON_BORDER+x*cell_size+cell_size-1-2, y*cell_size, CAM_TS_BUTTON_BORDER+x*cell_size+cell_size-1-2, y*cell_size+cell_size-1, cl); 
     255    draw_line(CAM_TS_BUTTON_BORDER+x*cell_size+2, y*cell_size+2, CAM_TS_BUTTON_BORDER+x*cell_size+cell_size-1-2, y*cell_size+2, cl); 
     256    draw_line(CAM_TS_BUTTON_BORDER+x*cell_size+2, y*cell_size+cell_size-1-2, CAM_TS_BUTTON_BORDER+x*cell_size+cell_size-1-2, y*cell_size+cell_size-1-2, cl); 
    256257} 
    257258 
     
    321322        return 0; 
    322323    } 
    323     need_redraw = 1; 
     324    need_redraw_all = 1; 
    324325    return 1; 
    325326} 
     
    363364      #endif 
    364365            sokoban_set_level(conf.sokoban_level); 
    365             need_redraw = 1; 
     366            need_redraw_all = 1; 
    366367            break; 
    367368      #if CAM_HAS_ERASE_BUTTON 
     
    378379    int y, x; 
    379380    static char str[16]; 
     381 
     382    if (need_redraw_all) { 
     383        draw_filled_rect(0, 0, screen_width-1, screen_height-1, MAKE_COLOR(SCREEN_COLOR, SCREEN_COLOR)); 
     384        need_redraw_all = 0; 
     385        need_redraw = 1; 
     386    } 
    380387 
    381388    if (need_redraw) { 
     
    385392                switch (field[y][x]) { 
    386393                    case MARKER_WALL: 
    387                         draw_filled_rect(x*cell_size, y*cell_size, x*cell_size+cell_size-1, y*cell_size+cell_size-1, MAKE_COLOR(WALL_COLOR_1, WALL_COLOR_2)); 
     394                        draw_filled_rect(CAM_TS_BUTTON_BORDER+x*cell_size, y*cell_size, CAM_TS_BUTTON_BORDER+x*cell_size+cell_size-1, y*cell_size+cell_size-1, MAKE_COLOR(WALL_COLOR_1, WALL_COLOR_2)); 
    388395                        break; 
    389396                    case MARKER_BOX: 
     
    391398                        break; 
    392399                    case MARKER_PLACE: 
    393                         draw_filled_rect(x*cell_size, y*cell_size, x*cell_size+cell_size-1, y*cell_size+cell_size-1, MAKE_COLOR(SCREEN_COLOR, SCREEN_COLOR)); 
    394                         draw_filled_rect(x*cell_size+4, y*cell_size+4, x*cell_size+cell_size-1-4, y*cell_size+cell_size-1-4, MAKE_COLOR(PLACE_COLOR_1, PLACE_COLOR_2)); 
     400                        draw_filled_rect(CAM_TS_BUTTON_BORDER+x*cell_size, y*cell_size, CAM_TS_BUTTON_BORDER+x*cell_size+cell_size-1, y*cell_size+cell_size-1, MAKE_COLOR(SCREEN_COLOR, SCREEN_COLOR)); 
     401                        draw_filled_rect(CAM_TS_BUTTON_BORDER+x*cell_size+4, y*cell_size+4, CAM_TS_BUTTON_BORDER+x*cell_size+cell_size-1-4, y*cell_size+cell_size-1-4, MAKE_COLOR(PLACE_COLOR_1, PLACE_COLOR_2)); 
    395402                        break; 
    396403                    case MARKER_BOX_PLACE: 
     
    399406                    case MARKER_PLAYER: 
    400407                    case MARKER_PLAYER_PLACE: 
    401                         draw_filled_rect(x*cell_size, y*cell_size, x*cell_size+cell_size-1, y*cell_size+cell_size-1, MAKE_COLOR(SCREEN_COLOR, SCREEN_COLOR)); 
    402                         draw_filled_ellipse(x*cell_size+(cell_size>>1)-1, y*cell_size+(cell_size>>1)-1, (cell_size>>1)-3, (cell_size>>1)-3, MAKE_COLOR(PLAYER_COLOR_1, PLAYER_COLOR_2)); 
     408                        draw_filled_rect(CAM_TS_BUTTON_BORDER+x*cell_size, y*cell_size, CAM_TS_BUTTON_BORDER+x*cell_size+cell_size-1, y*cell_size+cell_size-1, MAKE_COLOR(SCREEN_COLOR, SCREEN_COLOR)); 
     409                        draw_filled_ellipse(CAM_TS_BUTTON_BORDER+x*cell_size+(cell_size>>1)-1, y*cell_size+(cell_size>>1)-1, (cell_size>>1)-3, (cell_size>>1)-3, MAKE_COLOR(PLAYER_COLOR_1, PLAYER_COLOR_2)); 
    403410                        break; 
    404411                    case MARKER_EMPTY: 
    405412                    default: 
    406                         draw_filled_rect(x*cell_size, y*cell_size, x*cell_size+cell_size-1, y*cell_size+cell_size-1, MAKE_COLOR(SCREEN_COLOR, SCREEN_COLOR)); 
     413                        draw_filled_rect(CAM_TS_BUTTON_BORDER+x*cell_size, y*cell_size, CAM_TS_BUTTON_BORDER+x*cell_size+cell_size-1, y*cell_size+cell_size-1, MAKE_COLOR(SCREEN_COLOR, SCREEN_COLOR)); 
    407414                        break; 
    408415                } 
     
    410417        } 
    411418 
    412         draw_line(cell_size*FIELD_WIDTH, 0, cell_size*FIELD_WIDTH, screen_height-1, COLOR_WHITE); 
    413         draw_line(cell_size*FIELD_WIDTH+1, 0, cell_size*FIELD_WIDTH+1, screen_height-1, COLOR_BLACK); 
    414  
    415         //draw_filled_rect(cell_size*FIELD_WIDTH+2, 0, screen_width-1, 7, MAKE_COLOR(SCREEN_COLOR, SCREEN_COLOR)); 
    416         draw_filled_rect(cell_size*FIELD_WIDTH+2, 0, screen_width-1, screen_height-1, MAKE_COLOR(SCREEN_COLOR, SCREEN_COLOR)); 
     419        draw_line(CAM_TS_BUTTON_BORDER+cell_size*FIELD_WIDTH, 0, CAM_TS_BUTTON_BORDER+cell_size*FIELD_WIDTH, screen_height-1, COLOR_WHITE); 
     420        draw_line(CAM_TS_BUTTON_BORDER+cell_size*FIELD_WIDTH+1, 0, CAM_TS_BUTTON_BORDER+cell_size*FIELD_WIDTH+1, screen_height-1, COLOR_BLACK); 
    417421 
    418422        sprintf(str, "%s: %-6d", lang_str(LANG_SOKOBAN_TEXT_LEVEL), conf.sokoban_level+1); 
    419         draw_string(cell_size*FIELD_WIDTH+2, 8, str, MAKE_COLOR(SCREEN_COLOR, COLOR_WHITE)); 
     423        draw_string(CAM_TS_BUTTON_BORDER+cell_size*FIELD_WIDTH+2, 8, str, MAKE_COLOR(SCREEN_COLOR, COLOR_WHITE)); 
    420424        sprintf(str, "%s: %-6d", lang_str(LANG_SOKOBAN_TEXT_MOVES), moves); 
    421         draw_string(cell_size*FIELD_WIDTH+2, 8+FONT_HEIGHT, str, MAKE_COLOR(SCREEN_COLOR, COLOR_WHITE)); 
     425        draw_string(CAM_TS_BUTTON_BORDER+cell_size*FIELD_WIDTH+2, 8+FONT_HEIGHT, str, MAKE_COLOR(SCREEN_COLOR, COLOR_WHITE)); 
    422426 
    423427        //draw_filled_rect(cell_size*FIELD_WIDTH+2, 8+FONT_HEIGHT*2, screen_width-1, screen_height-1, MAKE_COLOR(SCREEN_COLOR, SCREEN_COLOR)); 
     
    430434 
    431435    sprintf(str, "Batt:%3d%%", get_batt_perc()); 
    432     draw_txt_string(screen_width/FONT_WIDTH-2-9, screen_height/FONT_HEIGHT-1, str, MAKE_COLOR(SCREEN_COLOR, COLOR_WHITE)); 
    433 } 
    434  
     436    draw_txt_string((screen_width-CAM_TS_BUTTON_BORDER)/FONT_WIDTH-2-9, screen_height/FONT_HEIGHT-1, str, MAKE_COLOR(SCREEN_COLOR, COLOR_WHITE)); 
     437} 
     438 
  • trunk/core/kbd.c

    r1327 r1338  
    9292static int nTxtbl[]={0,2,4,6,8,10,12,13}; 
    9393#endif 
    94 // ------ add by Masuji SUTO (end)   -------------- 
     94 
    9595#if defined(CAMERA_sx100is) || defined(CAMERA_sx110is) 
    9696#define ZSTEP_TABLE_SIZE 8 
     
    112112static int nTxtbl[]={0,1,2,3,4,5,6,7,8,9,10,11,12,13}; 
    113113#endif 
     114 
     115#if defined(CAMERA_ixus310_elph500hs) 
     116#define ZSTEP_TABLE_SIZE 9 
     117static int nTxtbl[]={0,8,16,24,32,40,48,56,64}; 
     118#endif 
     119 
    114120#if defined(CAMERA_s90) || defined(CAMERA_s95) 
    115121#define ZSTEP_TABLE_SIZE 10 
    116122static int nTxtbl[]={0,1,2,3,4,5,6,7,8,9}; 
    117123#endif 
     124// ------ add by Masuji SUTO (end)   -------------- 
    118125 
    119126#ifdef OPT_SCRIPTING 
     
    209216        return 1; 
    210217    } 
     218 
     219#ifdef CAM_TOUCHSCREEN_UI 
     220    extern int ts_process_touch(); 
     221    if (ts_process_touch()) 
     222    { 
     223        extern void draw_restore(); 
     224        draw_restore(); 
     225    } 
     226#endif 
    211227 
    212228    // deals with the rest 
  • trunk/core/raw.c

    r1249 r1338  
    117117    int i; 
    118118    if (gamma[255]) return; 
    119 #if defined(CAMERA_sx30) || defined(CAMERA_g12) 
     119#if defined(CAMERA_sx30) || defined(CAMERA_g12) || defined(CAMERA_ixus310_elph500hs) 
    120120    for (i=0; i<12; i++) gamma[i]=255*pow(i/255.0, 0.5); 
    121121    for (i=12; i<64; i++) gamma[i]=255*pow(i/255.0, 0.4); 
  • trunk/include/camera.h

    r1307 r1338  
    6363                                                // The guard pixel is the first pixel of the top row in the screen bitmap. 
    6464 
     65#undef  CAM_TOUCHSCREEN_UI                      // Define to enable touch screen U/I (e.g. IXUS 310 HS) 
     66#define CAM_TS_BUTTON_BORDER        0           // Define this to leave a border on each side of the OSD display for touch screen buttons. 
     67                                                // Used on the IXUS 310 to stop the OSD from overlapping the on screen buttons on each side 
     68#define CAM_DISP_ALT_TEXT           1           // Display the '<ALT>' message at the bottom of the screen in ALT mode (IXUS 310 changes button color instead) 
     69 
    6570#undef  CAM_AF_SCAN_DURING_VIDEO_RECORD         // CHDK can make single AF scan during video record 
    6671#undef  CAM_HAS_VIDEO_BUTTON                    // Camera can take stills in video mode, and vice versa 
  • trunk/include/conf.h

    r1245 r1338  
    278278    int flash_manual_override; 
    279279    int flash_video_override_power; 
     280 
     281    // Overrides to disable touchscreen U/I components (IXUS 310) 
     282    int touchscreen_disable_video_controls; 
     283    int touchscreen_disable_shortcut_controls; 
    280284} Conf; 
    281285 
  • trunk/include/gui.h

    r1034 r1338  
    77#define MAKE_COLOR(bg, fg)    ((color)((((char)(bg))<<8)|((char)(fg)))) 
    88 
     9// Don't delete or re-order entries unless guiHandlers (gui.c) table is updated to match  
    910enum Gui_Mode { 
    1011    GUI_MODE_NONE = 0, 
  • trunk/include/keyboard.h

    r1292 r1338  
    5656extern void other_kbd_process(); 
    5757 
     58#ifdef CAM_TOUCHSCREEN_UI 
     59extern int redraw_buttons; 
    5860#endif 
     61 
     62#endif 
  • trunk/include/lolevel.h

    r1335 r1338  
    260260extern int some_flag_for_af_scan; 
    261261extern int parameter_for_af_scan; 
    262 extern void _SetAE_ShutterSpeed(short* tv); 
     262extern short _SetAE_ShutterSpeed(short* tv); 
    263263 
    264264extern void _EnterToCompensationEVF(void); 
  • trunk/include/modelist.h

    r1232 r1338  
    114114    MODE_SCN_WINK_SELF_TIMER, // sx30/g12 (Smart Shutter, Wink Self Timer mode) 
    115115    MODE_SCN_FACE_SELF_TIMER, // sx30/g12 (Smart Shutter, Face Self Timer mode) 
     116    MODE_VIDEO_SUPER_SLOW   ,   // IXUS 310 HS Super Slow Motion Movie 
    116117}; 
    117118 
  • trunk/include/platform.h

    r1316 r1338  
    589589#endif 
    590590 
    591 #endif 
     591#ifdef CAM_TOUCHSCREEN_UI 
     592extern unsigned short  touch_screen_x, touch_screen_y; 
     593extern int touch_screen_active; 
     594#endif 
     595 
     596#endif 
Note: See TracChangeset for help on using the changeset viewer.