Changeset 479 for branches/juciphox/core/gui.c
- Timestamp:
- 08/12/08 12:52:17 (5 years ago)
- File:
-
- 1 edited
-
branches/juciphox/core/gui.c (modified) (22 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/juciphox/core/gui.c
r473 r479 31 31 #include "raw.h" 32 32 #include "curves.h" 33 33 #include "gui_logo.h" 34 34 //------------------------------------------------------------------- 35 35 … … 146 146 static const char* gui_raw_prefix_enum(int change, int arg); 147 147 static const char* gui_raw_ext_enum(int change, int arg); 148 static const char* gui_sub_batch_prefix_enum(int change, int arg); 149 static const char* gui_sub_batch_ext_enum(int change, int arg); 150 148 151 static const char* gui_raw_nr_enum(int change, int arg); 149 152 static const char* gui_autoiso_shutter_enum(int change, int arg); … … 193 196 static const char* gui_override_disable_enum(int change, int arg); 194 197 static const char* gui_conf_curve_enum(int change, int arg); 198 static const char* gui_debug_shortcut_enum(int change, int arg); 199 static const char* gui_debug_display_enum(int change, int arg); 200 static void gui_debug_shortcut(void); 201 195 202 void rinit(); 196 203 … … 207 214 static void cb_zebra_restore_osd(); 208 215 216 static int debug_tasklist_start; 217 static int debug_display_direction=1; 209 218 // Menu definition 210 219 //------------------------------------------------------------------- … … 236 245 {0x5d,LANG_MENU_SCRIPT_DEFAULT_VAL, MENUITEM_PROC, (int*)gui_load_script_default }, 237 246 {0x5e,LANG_MENU_SCRIPT_PARAM_SET, MENUITEM_ENUM, (int*)gui_script_param_set_enum }, 247 {0x5c,LANG_MENU_SCRIPT_PARAM_SAVE, MENUITEM_BOOL, &conf.script_param_save }, 238 248 {0x0,(int)script_title, MENUITEM_SEPARATOR }, 239 249 // {0x0,LANG_MENU_SCRIPT_CURRENT, MENUITEM_SEPARATOR }, … … 317 327 318 328 static CMenuItem debug_submenu_items[] = { 319 {0x5c,LANG_MENU_DEBUG_SHOW_PROPCASES, MENUITEM_BOOL, &debug_propcase_show }, 320 {0x5c,LANG_MENU_DEBUG_SHOW_PARAMETER_DATA, MENUITEM_BOOL, &debug_pardata_show }, 329 {0x5c,LANG_MENU_DEBUG_DISPLAY, MENUITEM_ENUM, (int*)gui_debug_display_enum }, 321 330 {0x2a,LANG_MENU_DEBUG_PROPCASE_PAGE, MENUITEM_INT|MENUITEM_F_UNSIGNED|MENUITEM_F_MINMAX, &debug_propcase_page, MENU_MINMAX(0, 128) }, 331 {0x2a,LANG_MENU_DEBUG_TASKLIST_START, MENUITEM_INT|MENUITEM_F_UNSIGNED|MENUITEM_F_MINMAX, &debug_tasklist_start, MENU_MINMAX(0, 63) }, 322 332 {0x5c,LANG_MENU_DEBUG_SHOW_MISC_VALS, MENUITEM_BOOL, &debug_vals_show }, 323 333 {0x2a,LANG_MENU_DEBUG_MEMORY_BROWSER, MENUITEM_PROC, (int*)gui_draw_debug }, 324 334 {0x2a,LANG_MENU_DEBUG_BENCHMARK, MENUITEM_PROC, (int*)gui_draw_bench }, 325 {0x5c,LANG_MENU_DEBUG_ DUMP_RAM, MENUITEM_BOOL, &conf.ns_enable_memdump},335 {0x5c,LANG_MENU_DEBUG_SHORTCUT_ACTION, MENUITEM_ENUM, (int*)gui_debug_shortcut_enum }, 326 336 {0x33,LANG_MENU_DEBUG_MAKE_BOOTABLE, MENUITEM_PROC, (int*)gui_menuproc_mkbootdisk }, 327 337 #if CAM_MULTIPART … … 661 671 {0x5f,LANG_MENU_RAW_PREFIX, MENUITEM_ENUM, (int*)gui_raw_prefix_enum }, 662 672 {0x5f,LANG_MENU_RAW_EXTENSION, MENUITEM_ENUM, (int*)gui_raw_ext_enum }, 673 {0x5f,LANG_MENU_SUB_PREFIX, MENUITEM_ENUM, (int*)gui_sub_batch_prefix_enum }, 674 {0x5f,LANG_MENU_SUB_EXTENSION, MENUITEM_ENUM, (int*)gui_sub_batch_ext_enum }, 675 {0x60,LANG_MENU_SUB_IN_DARK_VALUE, MENUITEM_INT|MENUITEM_F_UNSIGNED|MENUITEM_F_MINMAX, &conf.sub_in_dark_value, MENU_MINMAX(0, 1023)}, 676 {0x60,LANG_MENU_SUB_OUT_DARK_VALUE, MENUITEM_INT|MENUITEM_F_UNSIGNED|MENUITEM_F_MINMAX, &conf.sub_out_dark_value, MENU_MINMAX(0, 1023)}, 663 677 {0x2a,LANG_MENU_RAW_DEVELOP, MENUITEM_PROC, (int*)gui_raw_develop }, 664 678 {0x5c,LANG_MENU_BAD_PIXEL_REMOVAL, MENUITEM_ENUM, (int*)gui_bad_pixel_enum }, … … 814 828 if (change != 0) 815 829 { 830 if (conf.script_param_save) 831 { 816 832 save_params_values(0); 817 833 } 818 834 conf.script_param_set += change; 819 835 if (conf.script_param_set < 0) conf.script_param_set = (sizeof(modes)/sizeof(modes[0]))-1; else … … 911 927 //------------------------------------------------------------------- 912 928 const char* gui_raw_prefix_enum(int change, int arg) { 913 static const char* prefixes[]={ "IMG_", "CRW_", "SND_"};914 915 929 conf.raw_prefix+=change; 916 930 if (conf.raw_prefix<0) 917 conf.raw_prefix= (sizeof(prefixes)/sizeof(prefixes[0]))-1;918 else if (conf.raw_prefix>= (sizeof(prefixes)/sizeof(prefixes[0])))931 conf.raw_prefix=NUM_IMG_PREFIXES-1; 932 else if (conf.raw_prefix>=NUM_IMG_PREFIXES) 919 933 conf.raw_prefix=0; 920 934 921 return prefixes[conf.raw_prefix];935 return img_prefixes[conf.raw_prefix]; 922 936 } 923 937 924 938 //------------------------------------------------------------------- 925 939 const char* gui_raw_ext_enum(int change, int arg) { 926 static const char* exts[]={ ".JPG", ".CRW", ".CR2", ".THM", ".WAV"};927 928 940 conf.raw_ext+=change; 929 941 if (conf.raw_ext<0) 930 conf.raw_ext= (sizeof(exts)/sizeof(exts[0]))-1;931 else if (conf.raw_ext>= (sizeof(exts)/sizeof(exts[0])))942 conf.raw_ext=NUM_IMG_EXTS-1; 943 else if (conf.raw_ext>=NUM_IMG_EXTS) 932 944 conf.raw_ext=0; 933 945 934 return exts[conf.raw_ext]; 946 return img_exts[conf.raw_ext]; 947 } 948 949 //------------------------------------------------------------------- 950 const char* gui_sub_batch_prefix_enum(int change, int arg) { 951 conf.sub_batch_prefix+=change; 952 if (conf.sub_batch_prefix<0) 953 conf.sub_batch_prefix=NUM_IMG_PREFIXES-1; 954 else if (conf.sub_batch_prefix>=NUM_IMG_PREFIXES) 955 conf.sub_batch_prefix=0; 956 957 return img_prefixes[conf.sub_batch_prefix]; 958 } 959 960 //------------------------------------------------------------------- 961 const char* gui_sub_batch_ext_enum(int change, int arg) { 962 conf.sub_batch_ext+=change; 963 if (conf.sub_batch_ext<0) 964 conf.sub_batch_ext=NUM_IMG_EXTS-1; 965 else if (conf.sub_batch_ext>=NUM_IMG_EXTS) 966 conf.sub_batch_ext=0; 967 968 return img_exts[conf.sub_batch_ext]; 935 969 } 936 970 … … 1257 1291 //------------------------------------------------------------------- 1258 1292 const char* gui_video_bitrate_enum(int change, int arg) { 1259 static const char* modes[]={ "0.25x", "0.5x","0.75x", "1x", "1.25x", "1.5x", "1.75x", "2x", "2.5x", "3x"};1260 1261 1293 conf.video_bitrate+=change; 1262 1294 if (conf.video_bitrate<0) 1263 conf.video_bitrate= sizeof(modes)/sizeof(modes[0])-1;1264 else if (conf.video_bitrate>= (sizeof(modes)/sizeof(modes[0])))1295 conf.video_bitrate=VIDEO_BITRATE_STEPS-1; 1296 else if (conf.video_bitrate>=VIDEO_BITRATE_STEPS) 1265 1297 conf.video_bitrate=0; 1266 1298 1267 1299 shooting_video_bitrate_change(conf.video_bitrate); 1268 1300 1269 return modes[conf.video_bitrate];1301 return video_bitrate_strings[conf.video_bitrate]; 1270 1302 } 1271 1303 … … 1589 1621 int m=mode_get(); 1590 1622 gui_fselect_init(LANG_RAW_DEVELOP_SELECT_FILE, "A/DCIM", raw_fselect_cb); 1623 } 1624 1625 //------------------------------------------------------------------- 1626 #define TASKLIST_MAX_LINES 12 // probably as much as will fit on screen 1627 #define TASKLIST_NUM_TASKS 64 // should be enough ? 1628 static void gui_debug_draw_tasklist(void) { 1629 #ifndef CAM_DRYOS 1630 int tasklist[TASKLIST_NUM_TASKS]; // max number of tasks we will look at 1631 char buf[40]; // a single line of the list 1632 int n_tasks,n_show_tasks,show_start; 1633 const char *name; 1634 int i; 1635 n_tasks = task_id_list_get(tasklist,sizeof(tasklist)/sizeof(tasklist[0])); 1636 show_start = debug_tasklist_start; 1637 n_show_tasks = n_tasks - show_start; 1638 // auto adjust to show the last N tasks 1639 if(n_show_tasks < TASKLIST_MAX_LINES) { 1640 show_start = n_tasks - TASKLIST_MAX_LINES; 1641 if(show_start<0) 1642 show_start = 0; 1643 n_show_tasks = n_tasks - show_start; 1644 } 1645 else if( n_show_tasks > TASKLIST_MAX_LINES ) { 1646 n_show_tasks = TASKLIST_MAX_LINES; 1647 } 1648 sprintf(buf,"%d-%d of %d tasks %c",show_start,show_start+n_show_tasks,n_tasks,debug_display_direction > 0?'+':'-'); 1649 draw_string(64,0,buf, conf.osd_color); 1650 for( i = 0; i < n_show_tasks; i++ ) { 1651 // TODO get full task info 1652 name = task_name(tasklist[show_start+i]); 1653 if ( !name || !*name ) { 1654 name = "(unknown)"; 1655 } 1656 sprintf(buf,"%10s %8X",name,tasklist[show_start+i]); 1657 draw_string(64,16+16*i,buf, conf.osd_color); 1658 } 1659 #endif //CAM_DRYOS 1660 } 1661 1662 #define DEBUG_DISPLAY_NONE 0 1663 #define DEBUG_DISPLAY_PROPS 1 1664 #define DEBUG_DISPLAY_PARAMS 2 1665 #define DEBUG_DISPLAY_TASKS 3 1666 static const char * gui_debug_shortcut_enum(int change, int arg) { 1667 static const char* modes[]={ "None", "Dmp RAM", "Page"}; 1668 1669 conf.debug_shortcut_action += change; 1670 if (conf.debug_shortcut_action < 0) 1671 conf.debug_shortcut_action = sizeof(modes)/sizeof(modes[0])-1; 1672 else if (conf.debug_shortcut_action >= (sizeof(modes)/sizeof(modes[0]))) 1673 conf.debug_shortcut_action = 0; 1674 1675 return modes[conf.debug_shortcut_action]; 1676 } 1677 1678 static const char * gui_debug_display_enum(int change, int arg) { 1679 static const char* modes[]={ "None", "Props", "Params", "Tasks"}; 1680 1681 conf.debug_display += change; 1682 if (conf.debug_display < 0) 1683 conf.debug_display=sizeof(modes)/sizeof(modes[0])-1; 1684 else if (conf.debug_display >= (sizeof(modes)/sizeof(modes[0]))) 1685 conf.debug_display = 0; 1686 1687 return modes[conf.debug_display]; 1688 } 1689 1690 static void gui_debug_shortcut(void) { 1691 static int lastcall = -1; 1692 int t=get_tick_count(); 1693 if ( lastcall != -1) { 1694 if (t-lastcall <= 400) 1695 debug_display_direction = -debug_display_direction; 1696 } 1697 lastcall=t; 1698 switch(conf.debug_shortcut_action) { 1699 case 1: 1700 dump_memory(); 1701 break; 1702 case 2: 1703 if(conf.debug_display == DEBUG_DISPLAY_TASKS) { 1704 debug_tasklist_start += debug_display_direction*(TASKLIST_MAX_LINES-2); // a little intentional overlap 1705 if(debug_tasklist_start >= TASKLIST_NUM_TASKS || debug_tasklist_start < 0) 1706 debug_tasklist_start = 0; 1707 } 1708 else if (conf.debug_display == DEBUG_DISPLAY_PROPS || conf.debug_display == DEBUG_DISPLAY_PARAMS) { 1709 debug_propcase_page += debug_display_direction*1; 1710 if(debug_propcase_page > 128 || debug_propcase_page < 0) 1711 debug_propcase_page = 0; 1712 } 1713 break; 1714 } 1591 1715 } 1592 1716 … … 1847 1971 case GUI_MODE_ALT: 1848 1972 if (kbd_is_key_clicked(SHORTCUT_TOGGLE_RAW)) { 1849 if (conf. ns_enable_memdump) dump_memory();1973 if (conf.debug_shortcut_action > 0) gui_debug_shortcut(); 1850 1974 #if !CAM_HAS_ERASE_BUTTON && CAM_CAN_SD_OVERRIDE 1851 1975 else if (!shooting_get_common_focus_mode()) … … 2125 2249 } 2126 2250 2127 mode_video = ((m&MODE_SHOOTING_MASK)==MODE_VIDEO_STD || 2128 (m&MODE_SHOOTING_MASK)==MODE_VIDEO_SPEED || 2129 (m&MODE_SHOOTING_MASK)==MODE_VIDEO_COMPACT || 2130 (m&MODE_SHOOTING_MASK)==MODE_VIDEO_MY_COLORS || 2131 (m&MODE_SHOOTING_MASK)==MODE_VIDEO_COLOR_ACCENT || 2132 (m&MODE_SHOOTING_MASK)==MODE_VIDEO_TIME_LAPSE); 2133 2134 2251 // TODO some of the ifs below should probably use this 2252 mode_video = MODE_IS_VIDEO(m); 2253 2135 2254 mode_photo = (m&MODE_MASK) == MODE_PLAY || 2136 2255 !( mode_video || … … 2183 2302 gui_grid_draw_osd(1); 2184 2303 } 2185 if ((gui_mode==GUI_MODE_NONE || gui_mode==GUI_MODE_ALT) && (((kbd_is_key_pressed(KEY_SHOOT_HALF) || (state_kbd_script_run) || (shooting_get_common_focus_mode())) && (mode_photo || (m&MODE_SHOOTING_MASK)==MODE_STITCH )) || ( mode_video&& conf.show_values_in_video) )) {2304 if ((gui_mode==GUI_MODE_NONE || gui_mode==GUI_MODE_ALT) && (((kbd_is_key_pressed(KEY_SHOOT_HALF) || (state_kbd_script_run) || (shooting_get_common_focus_mode())) && (mode_photo || (m&MODE_SHOOTING_MASK)==MODE_STITCH )) || ((mode_video || movie_status > 1) && conf.show_values_in_video) )) { 2186 2305 2187 2306 if (conf.show_dof!=DOF_DONT_SHOW) gui_osd_calc_dof(); … … 2191 2310 if (conf.values_show_real_iso || conf.values_show_market_iso || conf.values_show_ev_seted || conf.values_show_ev_measured || conf.values_show_bv_measured || conf.values_show_bv_seted || conf.values_show_overexposure || conf.values_show_canon_overexposure) gui_osd_calc_expo_param(); 2192 2311 } 2193 if (conf.show_state && !mode_video) gui_osd_draw_state();2312 if (conf.show_state) gui_osd_draw_state(); 2194 2313 if (conf.save_raw && conf.show_raw_state && !mode_video && (!kbd_is_key_pressed(KEY_SHOOT_HALF))) gui_osd_draw_raw_info(); 2195 2314 2196 if ((conf.show_values==SHOW_ALWAYS && mode_photo) || ( mode_video&& conf.show_values_in_video) || ((kbd_is_key_pressed(KEY_SHOOT_HALF) || (recreview_hold==1)) && (conf.show_values==SHOW_HALF)))2315 if ((conf.show_values==SHOW_ALWAYS && mode_photo) || ((mode_video || movie_status > 1)&& conf.show_values_in_video) || ((kbd_is_key_pressed(KEY_SHOOT_HALF) || (recreview_hold==1)) && (conf.show_values==SHOW_HALF))) 2197 2316 gui_osd_draw_values(1); 2198 2317 else if (shooting_get_common_focus_mode() && mode_photo && conf.show_values && !(conf.show_dof==DOF_SHOW_IN_DOF) ) … … 2219 2338 gui_osd_draw_temp(); 2220 2339 } 2221 if (conf.show_movie_time > 0 )2340 if (conf.show_movie_time > 0 && (mode_video || movie_status > 1)) 2222 2341 { 2223 2342 gui_osd_draw_movie_time_left(); 2224 2225 if ((movie_status > 1) && (conf.fast_movie_quality_control==1)){2226 if (conf.video_mode == 0 )2227 {2228 gui_print_osd_state_string_chr("Bitrate: ",gui_video_bitrate_enum(0,0));2229 }2230 else2231 {2232 gui_print_osd_state_string_int("Quality: ",conf.video_quality);2233 }2234 }2235 2343 } 2236 2344 … … 2270 2378 static char sbuf[100]; 2271 2379 int r,i, p, len; 2272 if ( debug_propcase_show){2380 if (conf.debug_display == DEBUG_DISPLAY_PROPS){ 2273 2381 2274 2382 for (i=0;i<10;i++){ … … 2281 2389 } 2282 2390 2283 if (debug_pardata_show){2391 if (conf.debug_display == DEBUG_DISPLAY_PARAMS){ 2284 2392 extern long* FlashParamsTable[]; 2285 2393 char s[30]; … … 2308 2416 } 2309 2417 2418 if(conf.debug_display == DEBUG_DISPLAY_TASKS) { 2419 gui_debug_draw_tasklist(); 2420 } 2310 2421 2311 2422 if (ubasic_error){ … … 2443 2554 int i, l; 2444 2555 // color cl = MAKE_COLOR((gui_splash_mode==MODE_REC)?0xDA:0xD9, COLOR_WHITE); 2445 color cl = MAKE_COLOR(COLOR_RED, COLOR_WHITE);2556 color cl = MAKE_COLOR(COLOR_RED, COLOR_WHITE); 2446 2557 2447 2558 … … 2456 2567 w=w*FONT_WIDTH+10; 2457 2568 2458 x = (screen_width-w)>>1; y = ( screen_height-h)>>1;2459 draw_filled_round_rect(x, y, x+w, y+h, cl);2569 x = (screen_width-w)>>1; y = ((screen_height-h)>>1) + 20; 2570 draw_filled_round_rect(x, y, x+w, y+h, MAKE_COLOR(COLOR_RED, COLOR_RED)); 2460 2571 for (i=0; i<sizeof(text)/sizeof(text[0]); ++i) { 2461 2572 draw_string(x+((w-strlen(text[i])*FONT_WIDTH)>>1), y+i*FONT_HEIGHT+4, text[i], cl); 2573 } 2574 int mx,my; 2575 int offset_x = (screen_width-150)>>1; 2576 int offset_y = ((screen_height-84)>>1) - 42; 2577 2578 for(mx=0; mx<150; mx++){ 2579 for(my=0; my<84; my++){ 2580 color c = header_data[my*150+mx]; 2581 if (c != 0x00) 2582 draw_pixel(offset_x+mx,offset_y+my,c); 2583 } 2462 2584 } 2463 2585 } … … 2490 2612 void gui_load_script_default(int arg) { 2491 2613 script_load(conf.script_file, 0); 2492 save_params_values(1); 2493 } 2614 if (conf.script_param_save) 2615 { 2616 save_params_values(1); 2617 }} 2494 2618 2495 2619
Note: See TracChangeset
for help on using the changeset viewer.