diff -r 1cefe7b4d017 src/af_patterns.c --- a/src/af_patterns.c Tue Jan 29 13:10:14 2013 +0200 +++ b/src/af_patterns.c Tue Jan 29 17:41:09 2013 +0200 @@ -393,6 +393,7 @@ .select = menu_open_submenu, .help = "Custom AF patterns (photo mode only). Ported from 400plus.", .submenu_height = 280, + .depends_on = DEP_PHOTO_MODE, .children = (struct menu_entry[]) { { .name = "Center selection", diff -r 1cefe7b4d017 src/audio-ak.c --- a/src/audio-ak.c Tue Jan 29 13:10:14 2013 +0200 +++ b/src/audio-ak.c Tue Jan 29 17:41:09 2013 +0200 @@ -573,7 +573,7 @@ .select_reverse = audio_mgain_toggle_reverse, .display = audio_mgain_display, .help = "Gain applied to both inputs in analog domain (preferred).", - //.essential = FOR_MOVIE, + .works_best_in = DEP_MOVIE_MODE, .edit_mode = EM_MANY_VALUES, }, #endif @@ -582,6 +582,7 @@ .name = "Digital Gain...", .select = menu_open_submenu, .help = "Digital gain (not recommended, use only for headphones!)", + .works_best_in = DEP_MOVIE_MODE, .children = (struct menu_entry[]) { { .name = "Left Digital Gain ", @@ -624,8 +625,7 @@ .select_reverse = audio_input_toggle_reverse, .display = audio_input_display, .help = "Audio input: internal / external / both / balanced / auto.", - //.essential = FOR_MOVIE, - //~ .edit_mode = EM_MANY_VALUES, + .works_best_in = DEP_MOVIE_MODE, }, #endif @@ -636,8 +636,7 @@ .display = audio_filters_display, .help = "High pass filter for wind noise reduction.", .select = audio_binary_toggle, - //~ .icon_type = IT_DISABLE_SOME_FEATURE, - //.essential = FOR_MOVIE, + .works_best_in = DEP_MOVIE_MODE, }, #endif @@ -656,7 +655,7 @@ .select = audio_binary_toggle, .display = audio_micpower_display, .help = "Needed for int. and some other mics, but lowers impedance.", - //.essential = FOR_MOVIE, + .works_best_in = DEP_MOVIE_MODE, }, #endif @@ -670,7 +669,7 @@ .select_reverse = audio_3bit_toggle_reverse, .display = audio_lovl_display, .help = "Output volume for audio monitoring (headphones only).", - //~ .edit_mode = EM_MANY_VALUES, + .depends_on = DEP_MOVIE_MODE, }, #endif { @@ -679,7 +678,7 @@ .select = audio_monitoring_toggle, .display = audio_monitoring_display, .help = "Monitoring via A-V jack. Disable if you use a SD display.", - //.essential = FOR_MOVIE, + .depends_on = DEP_MOVIE_MODE, }, #endif @@ -694,7 +693,7 @@ #else .help = "Bar peak decay, -40...0 dB, yellow at -12 dB, red at -3 dB.", #endif - //.essential = FOR_MOVIE, + .depends_on = DEP_GLOBAL_DRAW | DEP_MOVIE_MODE, }, #endif }; diff -r 1cefe7b4d017 src/beep.c --- a/src/beep.c Tue Jan 29 13:10:14 2013 +0200 +++ b/src/beep.c Tue Jan 29 17:41:09 2013 +0200 @@ -995,6 +995,7 @@ .priv = &voice_tags, .max = 1, .help = "After you take a picture, press SET to add a voice tag.", + .works_best_in = DEP_PHOTO_MODE, }, #endif MENU_EOL, diff -r 1cefe7b4d017 src/bitrate.c --- a/src/bitrate.c Tue Jan 29 13:10:14 2013 +0200 +++ b/src/bitrate.c Tue Jan 29 17:41:09 2013 +0200 @@ -636,6 +636,7 @@ .select = bitrate_toggle, .help = "Change H.264 bitrate. Be careful, recording may stop!", .edit_mode = EM_MANY_VALUES, + .depends_on = DEP_MOVIE_MODE, .children = (struct menu_entry[]) { { .name = "Mode", @@ -692,7 +693,7 @@ .display = time_indicator_display, .help = "Time indicator while recording.", //.essential = 1, - //~ .edit_mode = EM_MANY_VALUES, + .depends_on = DEP_MOVIE_MODE | DEP_GLOBAL_DRAW, }, #endif }; diff -r 1cefe7b4d017 src/dryos.h --- a/src/dryos.h Tue Jan 29 13:10:14 2013 +0200 +++ b/src/dryos.h Tue Jan 29 17:41:09 2013 +0200 @@ -458,14 +458,36 @@ #define ASSERT(x) { if (!(x)) { ml_assert_handler(#x, __FILE__, __LINE__, __func__); }} //~ #define ASSERT(x) {} -#define MIN(a,b) ((a) < (b) ? (a) : (b)) -#define MAX(a,b) ((a) > (b) ? (a) : (b)) +#define MIN(a,b) \ + ({ typeof ((a)+(b)) _a = (a); \ + typeof ((a)+(b)) _b = (b); \ + _a < _b ? _a : _b; }) + +#define MAX(a,b) \ + ({ typeof ((a)+(b)) _a = (a); \ + typeof ((a)+(b)) _b = (b); \ + _a > _b ? _a : _b; }) + #define COERCE(x,lo,hi) MAX(MIN((x),(hi)),(lo)) -#define ABS(a) ((a) > 0 ? (a) : -(a)) -#define SGN(a) ((a) > 0 ? 1 : (a) < 0 ? -1 : 0) + + +#define ABS(a) \ + ({ __typeof__ (a) _a = (a); \ + _a > 0 ? _a : -_a; }) + +#define SGN(a) \ + ({ __typeof__ (a) _a = (a); \ + _a > 0 ? 1 : _a < 0 ? -1 : 0; }) + #define SGNX(a) ((a) > 0 ? 1 : -1) + // mod like in math... x mod n is from 0 to n-1 -#define mod(x,m) ((((int)x) % ((int)m) + ((int)m)) % ((int)m)) +//~ #define mod(x,m) ((((int)x) % ((int)m) + ((int)m)) % ((int)m)) + +#define mod(x,m) \ + ({ int _x = (x); \ + int _m = (m); \ + (_x % _m + _m) % _m; }) #define STR_APPEND(orig,fmt,...) snprintf(orig + strlen(orig), sizeof(orig) - strlen(orig) - 1, fmt, ## __VA_ARGS__); diff -r 1cefe7b4d017 src/focus.c --- a/src/focus.c Tue Jan 29 13:10:14 2013 +0200 +++ b/src/focus.c Tue Jan 29 17:41:09 2013 +0200 @@ -793,15 +793,6 @@ bmp_printf(FONT_MED, x + 580, y+5, follow_focus_reverse_h ? "- +" : "+ -"); bmp_printf(FONT_MED, x + 580 + font_med.width, y-4, follow_focus_reverse_v ? "-\n+" : "+\n-"); } - if (follow_focus) - { - if (is_manual_focus()) menu_draw_icon(x, y, MNI_WARNING, (intptr_t) "Follow focus requires autofocus enabled."); - if (!lv) menu_draw_icon(x, y, MNI_WARNING, (intptr_t) "Follow focus only works in LiveView."); - #ifndef CONFIG_NO_HALFSHUTTER_AF_IN_LIVEVIEW - if (cfn_get_af_button_assignment() == AF_BTN_HALFSHUTTER) menu_draw_icon(x, y, MNI_WARNING, (intptr_t) "Set AF to back btn (*) from Canon menu (CFn / custom ctrl)."); - #endif - } - menu_draw_icon(x, y, MNI_BOOL_LV(follow_focus)); } #ifdef FEATURE_MOVIE_AF @@ -1188,13 +1179,10 @@ ); if (t) { - if (is_movie_mode()) menu_draw_icon(x, y, MNI_WARNING, (intptr_t) "Trap focus only works in photo mode."); - if (!is_manual_focus()) menu_draw_icon(x, y, MNI_WARNING, (intptr_t) "Trap focus only works with manual focus."); if (!lv && !lens_info.name[0]) menu_draw_icon(x, y, MNI_WARNING, (intptr_t) "Trap focus outside LiveView requires a chipped lens"); #ifndef CONFIG_LV_FOCUS_INFO if (lv) menu_draw_icon(x, y, MNI_WARNING, (intptr_t) "On your camera, trap focus doesn't work in LiveView."); #endif - if (lv && is_movie_mode()) menu_draw_icon(x, y, MNI_WARNING, (intptr_t) "Trap focus does not work in movie mode."); if (t == 2 && cfn_get_af_button_assignment() != AF_BTN_HALFSHUTTER) menu_draw_icon(x, y, MNI_WARNING, (intptr_t) "Assign AF button to half-shutter from CFn!"); } } @@ -1228,7 +1216,7 @@ .display = trap_focus_display, .help = "Takes a picture when the subject comes in focus. MF only.", .icon_type = IT_DICE_OFF, - + .depends_on = DEP_PHOTO_MODE | DEP_MANUAL_FOCUS, .children = (struct menu_entry[]) { { .name = "Shooting duration", @@ -1251,6 +1239,7 @@ .priv = &follow_focus, .display = follow_focus_print, .select = menu_binary_toggle, + .depends_on = DEP_LIVEVIEW | DEP_AUTOFOCUS | DEP_CFN_AF_BACK_BUTTON, .help = "Focus with arrow keys. MENU while REC = save focus point.", @@ -1292,6 +1281,7 @@ .select_reverse = movie_af_noisefilter_bump, .select_Q = movie_af_aggressiveness_bump, .help = "Custom AF algorithm in movie mode. Not very efficient." + .depends_on = DEP_LIVEVIEW | DEP_MOVIE_MODE | DEP_AUTOFOCUS, }, #endif @@ -1300,14 +1290,16 @@ .name = "Focus End Point", .display = focus_show_a, .select = focus_reset_a, - .help = "SET: fix here rack end point. ZoomIn+L/R: start point." + .help = "SET: fix here rack end point. ZoomIn+L/R: start point.", + .depends_on = DEP_LIVEVIEW | DEP_AUTOFOCUS, }, { .name = "Rack Delay ", .priv = &focus_rack_delay, .max = 20, .icon_type = IT_PERCENT, - .help = "Number of seconds before starting rack focus." + .help = "Number of seconds before starting rack focus.", + .depends_on = DEP_LIVEVIEW | DEP_AUTOFOCUS, }, { .name = "Rack Focus", @@ -1318,6 +1310,7 @@ .select_reverse = rack_focus_start_auto_record, .help = "Press SET for rack focus, or PLAY to also start recording.", .icon_type = IT_ACTION, + .depends_on = DEP_LIVEVIEW | DEP_AUTOFOCUS, }, #endif #ifdef FEATURE_FOCUS_STACKING @@ -1328,6 +1321,7 @@ .select = menu_binary_toggle, .select_reverse = focus_stack_trigger_from_menu, .help = "Focus bracketing, increases DOF while keeping bokeh.", + .depends_on = DEP_LIVEVIEW | DEP_AUTOFOCUS | DEP_PHOTO_MODE, .children = (struct menu_entry[]) { { .name = "Steps/Pic", diff -r 1cefe7b4d017 src/fps-engio.c --- a/src/fps-engio.c Tue Jan 29 13:10:14 2013 +0200 +++ b/src/fps-engio.c Tue Jan 29 17:41:09 2013 +0200 @@ -1095,7 +1095,7 @@ .select = fps_enable_disable, .display = fps_print, .help = "Changes FPS. Also disables sound and alters shutter speeds.", - //.essential = FOR_MOVIE, + .depends_on = DEP_LIVEVIEW, .submenu_width = 650, .children = (struct menu_entry[]) { { @@ -1198,7 +1198,7 @@ .priv = &fps_ramp, .max = 1, .help = "Press REC/" INFO_BTN_NAME " to start ramping. FPS override should be ON.", - //.essential = FOR_MOVIE, + .depends_on = DEP_MOVIE_MODE, .submenu_width = 650, .children = (struct menu_entry[]) { /* diff -r 1cefe7b4d017 src/hdr.c --- a/src/hdr.c Tue Jan 29 13:10:14 2013 +0200 +++ b/src/hdr.c Tue Jan 29 17:41:09 2013 +0200 @@ -425,6 +425,7 @@ .max = 1, .display = hdr_print, .help = "Alternates ISO between frames. Flickers while recording.", + .depends_on = DEP_MOVIE_MODE, .children = (struct menu_entry[]) { { .name = "ISO A", diff -r 1cefe7b4d017 src/lens.c --- a/src/lens.c Tue Jan 29 13:10:14 2013 +0200 +++ b/src/lens.c Tue Jan 29 17:41:09 2013 +0200 @@ -2045,6 +2045,7 @@ .select = menu_binary_toggle, .display = movielog_display, .help = "Save metadata for each movie, e.g. MVI_1234.LOG", + .depends_on = DEP_MOVIE_MODE, }, #endif }; diff -r 1cefe7b4d017 src/lv-img-engio.c --- a/src/lv-img-engio.c Tue Jan 29 13:10:14 2013 +0200 +++ b/src/lv-img-engio.c Tue Jan 29 17:41:09 2013 +0200 @@ -583,6 +583,7 @@ .max = 1, .select = menu_open_submenu, .help = "Experimental image filters found by digging into DIGIC.", + .depends_on = DEP_MOVIE_MODE, .children = (struct menu_entry[]) { { .name = "Desaturate", diff -r 1cefe7b4d017 src/menu.c --- a/src/menu.c Tue Jan 29 13:10:14 2013 +0200 +++ b/src/menu.c Tue Jan 29 17:41:09 2013 +0200 @@ -34,9 +34,8 @@ #define DOUBLE_BUFFERING 1 -#define MENU_KEYHELP_Y_POS (menu_lv_transparent_mode ? 425 : 430) -#define MENU_HELP_Y_POS 453 -#define MENU_WARNING_Y_POS (menu_lv_transparent_mode ? 425 : 453) +#define MENU_HELP_Y_POS 435 +#define MENU_WARNING_Y_POS 455 //for vscroll #define MENU_LEN_DEFAULT 11 @@ -243,12 +242,7 @@ menu_draw_icon(x, y, MNI_ACTION, 0); } - -static void entry_draw_icon( - struct menu_entry * entry, - int x, - int y -) +static void entry_guess_icon_type(struct menu_entry * entry) { if (entry->icon_type == IT_AUTO) { @@ -279,6 +273,23 @@ else entry->icon_type = IT_BOOL; } +} +static int entry_guess_truth_value(struct menu_entry * entry) +{ + if (entry->icon_type == IT_BOOL) + return MEM(entry->priv); + else if (entry->icon_type == IT_BOOL_NEG) + return !MEM(entry->priv); + else return 1; +} + +static void entry_draw_icon( + struct menu_entry * entry, + int x, + int y +) +{ + entry_guess_icon_type(entry); switch (entry->icon_type) { @@ -428,52 +439,203 @@ entry_draw_icon(entry, x, y); } -static struct menu_entry* -menu_find_by_id_entry( - struct menu_entry* root, - uint32_t id +static void +entry_default_display_info( + struct menu_entry * entry, + struct menu_display_info * info ) { - struct menu_entry * menu = root; + static char name[MENU_MAX_NAME_LEN]; + static char value[MENU_MAX_VALUE_LEN]; + static char help[MENU_MAX_HELP_LEN]; + static char warning[MENU_MAX_WARNING_LEN]; - for( ; menu ; menu = menu->next ) + name[0] = 0; + value[0] = 0; + help[0] = 0; + warning[0] = 0; + + info->name = name; + info->value = value; + info->help = help; + info->warning = warning; + info->custom_drawing = 0; + info->warning_level = 0; + + entry_guess_icon_type(entry); + info->truth_value = entry_guess_truth_value(entry); + + snprintf(name, sizeof(name), "%s", entry->name); + + if (entry->priv && entry->select != (void(*)(void*,int))run_in_separate_task) { - if( menu->id == id ) + if (entry->choices && MEM(entry->priv) <= entry->max) { - return menu; + STR_APPEND(value, "%s", entry->choices[MEM(entry->priv)]); } - if( menu->children ) + else if (entry->icon_type == IT_BOOL && entry->min == 0 && entry->max == 1) { - struct menu_entry * ch = menu_find_by_id_entry(menu->children, id); - if (ch!=NULL) return ch; + STR_APPEND(value, "%s", MEM(entry->priv) ? "ON" : "OFF"); } - } - return NULL; -} - -struct menu_entry * -menu_find_by_id( - uint32_t id -) -{ - struct menu * menu = menus; - - for( ; menu ; menu = menu->next ) - { - if( menu->id == id ) + else { - return menu->children; - } - if( menu->children ) - { - struct menu_entry * ch = menu_find_by_id_entry(menu->children, id); - if (ch!=NULL) return ch; + switch (entry->unit) + { + case UNIT_1_8_EV: + case UNIT_x10: + case UNIT_PERCENT_x10: + { + int v = MEM(entry->priv); + int den = entry->unit == UNIT_1_8_EV ? 8 : 10; + STR_APPEND(value, "%s%d", v < 0 ? "-" : "", ABS(v)/den); + int r = (ABS(v)%den)*10/den; + if (r) STR_APPEND(value, ".%d", r); + STR_APPEND(value, "%s", + entry->unit == UNIT_1_8_EV ? " EV" : + entry->unit == UNIT_PERCENT_x10 ? "%%" : "" + ); + break; + } + case UNIT_PERCENT: + { + STR_APPEND(value, "%d%%", MEM(entry->priv)); + break; + } + case UNIT_ISO: + { + if (!MEM(entry->priv)) { STR_APPEND(value, "Auto"); } + else { STR_APPEND(value, "%d", raw2iso(MEM(entry->priv))); } + break; + } + case UNIT_HEX: + { + STR_APPEND(value, "0x%x", MEM(entry->priv)); + break; + } + default: + { + STR_APPEND(value, "%d", MEM(entry->priv)); + break; + } + } } } - return NULL; + // default warnings + if ((entry->depends_on & DEP_GLOBAL_DRAW) && !get_global_draw()) + snprintf(warning, sizeof(warning), GDR_WARNING_MSG); + else if ((entry->depends_on & DEP_LIVEVIEW) && !lv) + snprintf(warning, sizeof(warning), "This feature only works in LiveView."); + else if ((entry->depends_on & DEP_NOT_LIVEVIEW) && lv) + snprintf(warning, sizeof(warning), "This feature does not work in LiveView."); + else if ((entry->depends_on & DEP_MOVIE_MODE) && !is_movie_mode()) + snprintf(warning, sizeof(warning), "This feature only works in movie mode."); + else if ((entry->depends_on & DEP_PHOTO_MODE) && is_movie_mode()) + snprintf(warning, sizeof(warning), "This feature only works in photo mode."); + else if ((entry->depends_on & DEP_AUTOFOCUS) && is_manual_focus()) + snprintf(warning, sizeof(warning), "This feature requires autofocus."); + else if ((entry->depends_on & DEP_MANUAL_FOCUS) && !is_manual_focus()) + snprintf(warning, sizeof(warning), "This feature requires manual focus."); + else if ((entry->depends_on & DEP_CFN_AF_HALFSHUTTER) && cfn_get_af_button_assignment() != AF_BTN_HALFSHUTTER) + snprintf(warning, sizeof(warning), "Set AF to Half-Shutter from Canon menu (CFn / custom ctrl)."); + else if ((entry->depends_on & DEP_CFN_AF_BACK_BUTTON) && cfn_get_af_button_assignment() != AF_BTN_STAR) + snprintf(warning, sizeof(warning), "Set AF to back btn (*) from Canon menu (CFn / custom ctrl)."); + else if ((entry->depends_on & DEP_EXPSIM) && !lv_luma_is_accurate()) + snprintf(warning, sizeof(warning), EXPSIM_WARNING_MSG); + else if ((entry->depends_on & DEP_NOT_EXPSIM) && lv_luma_is_accurate()) + snprintf(warning, sizeof(warning), "This feature requires ExpSim disabled."); + else if ((entry->depends_on & DEP_MANUAL_FOCUS) && !is_manual_focus()) + snprintf(warning, sizeof(warning), "This feature requires manual focus."); + else if ((entry->depends_on & DEP_CHIPPED_LENS) && !lens_info.name[0]) + snprintf(warning, sizeof(warning), "This feature requires a chipped (electronic) lens."); + else if ((entry->depends_on & DEP_M_MODE) && shooting_mode != SHOOTMODE_M) + snprintf(warning, sizeof(warning), "This feature requires Manual (M) mode."); + + if (warning[0]) + { + info->warning_level = W_GRAYED_OUT; + return; + } + + if ((entry->works_best_in & DEP_GLOBAL_DRAW) && !get_global_draw()) + snprintf(warning, sizeof(warning), "This feature works best with GlobalDraw enabled."); + else if ((entry->works_best_in & DEP_LIVEVIEW) && !lv) + snprintf(warning, sizeof(warning), "This feature works best in LiveView."); + else if ((entry->works_best_in & DEP_NOT_LIVEVIEW) && lv) + snprintf(warning, sizeof(warning), "This feature works best outside LiveView."); + else if ((entry->works_best_in & DEP_MOVIE_MODE) && !is_movie_mode()) + snprintf(warning, sizeof(warning), "This feature works best in movie mode."); + else if ((entry->works_best_in & DEP_PHOTO_MODE) && is_movie_mode()) + snprintf(warning, sizeof(warning), "This feature works best in photo mode."); + else if ((entry->works_best_in & DEP_AUTOFOCUS) && is_manual_focus()) + snprintf(warning, sizeof(warning), "This feature works best with autofocus enabled."); + else if ((entry->works_best_in & DEP_MANUAL_FOCUS) && !is_manual_focus()) + snprintf(warning, sizeof(warning), "This feature works best with manual focus."); + else if ((entry->works_best_in & DEP_CFN_AF_HALFSHUTTER) && cfn_get_af_button_assignment() != AF_BTN_HALFSHUTTER) + snprintf(warning, sizeof(warning), "Set AF to Half-Shutter from Canon menu (CFn / custom ctrl)."); + else if ((entry->works_best_in & DEP_CFN_AF_BACK_BUTTON) && cfn_get_af_button_assignment() != AF_BTN_STAR) + snprintf(warning, sizeof(warning), "Set AF to back btn (*) from Canon menu (CFn / custom ctrl)."); + else if ((entry->depends_on & DEP_EXPSIM) && !lv_luma_is_accurate()) + snprintf(warning, sizeof(warning), "This feature works best with ExpSim enabled."); + else if ((entry->depends_on & DEP_NOT_EXPSIM) && lv_luma_is_accurate()) + snprintf(warning, sizeof(warning), "This feature works best with ExpSim disabled."); + else if ((entry->works_best_in & DEP_CHIPPED_LENS) && !lens_info.name[0]) + snprintf(warning, sizeof(warning), "This feature works best with a chipped (electronic) lens."); + else if ((entry->works_best_in & DEP_M_MODE) && shooting_mode != SHOOTMODE_M) + snprintf(warning, sizeof(warning), "This feature works best in Manual (M) mode."); + + if (warning[0]) + info->warning_level = W_BE_CAREFUL; } +static void +entry_print( + int x, + int y, + int w, + struct menu_entry * entry, + struct menu_display_info * info +) +{ + int fnt = MENU_FONT; + + if (info->warning_level == W_GRAYED_OUT) + fnt = MENU_FONT_GRAY; + + bmp_printf( + fnt, + x, y, + info->name + ); + + if (info->truth_value == 0) + fnt = MENU_FONT_GRAY; + + bmp_printf( + fnt, + x + font_large.width * w, y, + info->value + ); + + if (info->warning_level == W_BE_CAREFUL) + { + bmp_printf( + MENU_FONT_GRAY, + x + 650, y, + "[!]" + ); + } + + // if there's a warning message set, display it + if (entry->selected && info->warning[0]) + { + bmp_printf( + FONT(FONT_MED, COLOR_YELLOW, COLOR_GRAY40), + 10, MENU_WARNING_Y_POS, + info->warning + ); + } +} static struct menu * @@ -518,6 +680,7 @@ new_menu->pos = 1; new_menu->childnum = 1; new_menu->childnummax = 1; + new_menu->name_width = -16; // menu points to the last entry or NULL if there are none if( menu ) { @@ -630,6 +793,14 @@ if( !menu ) return; + // auto adjust width so that all things can be printed nicely + // only "negative" numbers are auto-adjusted (if you override the width, you do so with a positive value) + if (new_entry->name && menu->name_width < 0) + { + menu->name_width = -MAX(-menu->name_width, strlen(new_entry->name) + 2); + if (-menu->name_width > 25) menu->name_width = -25; + } + int count0 = count; // for submenus take_semaphore( menu_sem, 0 ); @@ -844,7 +1015,7 @@ bmp_draw_rect(color, x + 15, y + 22, 10, 1); } -void selection_bar(int x0, int y0) +void FAST selection_bar(int x0, int y0) { if (menu_lv_transparent_mode) return; // only one menu, no need to highlight, and this routine conflicts with RGB zebras @@ -859,14 +1030,33 @@ c = D2V(c); black = D2V(black); #endif + #define P(x,y) B[BM(x,y)] for (int y = y0; y < y0 + 31; y++) { for (int x = x0-5; x < w; x++) { - if (B[BM(x,y)] == black) - B[BM(x,y)] = c; + if (P(x,y) == black) + P(x,y) = c; } } + for (int y = y0; y < y0 + 31; y++) + { + for (int x = x0-5; x < w; x++) + { + if (P(x,y) != c && P(x,y) != black) + { + for (int dx = -1; dx <= 1; dx++) + { + for (int dy = -1; dy <= 1; dy++) + { + if (P(x+dx,y+dy) == c) + P(x+dx,y+dy) = black; + } + } + } + } + } + #undef P } void dim_hidden_menu(int x0, int y0, int selected) @@ -1092,6 +1282,7 @@ int icon_drawn = 0; void menu_draw_icon(int x, int y, int type, intptr_t arg) { + return; #if !CONFIG_DEBUGMSG if (icon_drawn) return; icon_drawn = type; @@ -1195,33 +1386,25 @@ if (menu->selected && menu->help) { bmp_printf( - FONT(FONT_MED, 0xC, COLOR_BLACK), // red + FONT(FONT_MED, 0xC, COLOR_GRAY40), // red 10, MENU_HELP_Y_POS, " " ); bmp_printf( - FONT(FONT_MED, COLOR_WHITE, COLOR_BLACK), + FONT(FONT_MED, COLOR_WHITE, COLOR_GRAY40), 10, MENU_HELP_Y_POS, menu_help_get_line(menu->help, menu->priv) ); } - - // display icon (only the first icon is drawn) - icon_drawn = 0; + if ((!menu_lv_transparent_mode && !only_selected) || menu->selected) { if (quick_redraw && menu->selected) // selected menu was not erased, so there may be leftovers on the screen bmp_fill(menu_lv_transparent_mode ? 0 : COLOR_BLACK, x, y, g_submenu_width-50, font_large.height); - if (menu->display) - menu->display( - menu->priv, - x, - y, - menu->selected - ); - else - submenu_print(menu, x, y); + static struct menu_display_info info; + entry_default_display_info(menu, &info); + entry_print(x, y, ABS(parentmenu->name_width), menu, &info); if (menu->hidden && menu->hidden != MENU_ENTRY_NEVER_HIDE) dim_hidden_menu(x, y, menu->selected); @@ -1231,176 +1414,6 @@ if (icon_drawn == MNI_STOP_DRAWING) return; - // this should be after menu->display, in order to allow it to override the icon - if (menu->selected || (!menu_lv_transparent_mode && !only_selected)) - { - entry_draw_icon(menu, x, y); - } - - // display key help - if (menu->selected && !is_menu_active("Help") && (menu->priv || menu->select) && y + font_large.height < 430) - { - char msg[100] = ""; - - // this should follow exactly the same logic as in menu_entry_select - // todo: remove duplicate code - - - // exception for action and submenu items - if (icon_drawn == MNI_ACTION && !submenu_mode) - { - STR_APPEND(msg, "SET: run action "); - } - else if (menu->select == menu_open_submenu) - { - STR_APPEND(msg, "SET: open submenu "); - } - // exception end - - else if (submenu_mode == 2) - { - STR_APPEND(msg, "SET: toggle edit mode "); - } - else if (menu_lv_transparent_mode) - { - STR_APPEND(msg, "SET: toggle LiveView "); - } - else if (menu->edit_mode == EM_FEW_VALUES) // SET increments - { - STR_APPEND(msg, "SET: change value "); - } - else if (menu->edit_mode == EM_MANY_VALUES) - { - STR_APPEND(msg, "SET: toggle edit mode "); - } - else if (menu->edit_mode == EM_MANY_VALUES_LV) - { - if (lv) - { - STR_APPEND(msg, "SET: toggle LiveView "); - } - else if (submenu_mode != 1) - { - STR_APPEND(msg, "SET: toggle edit mode "); - } - else // increment - { - STR_APPEND(msg, "SET: change value "); - } - } - - - if (submenu_mode || menu_lv_transparent_mode || only_selected) - { - STR_APPEND(msg, " "); - #ifdef CONFIG_EOSM - if (!CURRENT_DIALOG_MAYBE) - #else - if (CURRENT_DIALOG_MAYBE) // GUIMode nonzero => wheel events working - #endif - { - #ifdef CONFIG_EOSM - STR_APPEND(msg, "Left/Right: "); - #else - STR_APPEND(msg, "L/R/Wheel : "); - #endif - } - else - { - #ifdef CONFIG_5DC - STR_APPEND(msg, "Main Dial: "); - #else - STR_APPEND(msg, "Left/Right: "); - #endif - } - if (icon_drawn == MNI_ACTION) - { - STR_APPEND(msg, "run action "); - } - else - { - STR_APPEND(msg, "change value"); - } - - #ifdef CONFIG_EOSM - if (!CURRENT_DIALOG_MAYBE) - #else - if (CURRENT_DIALOG_MAYBE) // we can use scrollwheel - #endif - bfnt_draw_char(ICON_MAINDIAL, 680, 415, COLOR_CYAN, COLOR_BLACK); - else - leftright_sign(690, 415); - } - else if (menu->children && !submenu_mode && !menu_lv_transparent_mode) - { - char *button = Q_BTN_NAME; - -#if defined(CONFIG_60D) || defined(CONFIG_600D) || defined(CONFIG_7D) // Q not working while recording, use INFO instead - if (recording) - { - button = "[INFO]"; - } -#endif - - int nspaces = 16 - strlen(button); - for (int i = 0; i < nspaces; i++) { STR_APPEND(msg, " "); } - - STR_APPEND(msg, "%s: open submenu ", button); - } - - //~ while (strlen(msg) < 60) { STR_APPEND(msg, " "); } - - - bmp_printf( - FONT(FONT_MED, COLOR_CYAN, COLOR_BLACK), - 10, MENU_KEYHELP_Y_POS, - msg - ); - - #if !defined(CONFIG_5DC) && !defined(CONFIG_EOSM) - if (!submenu_mode && !menu_lv_transparent_mode) // we can use scrollwheel for navigation - { - bfnt_draw_char(ICON_MAINDIAL, 680, 415, COLOR_GRAY50, COLOR_BLACK); - if (!CURRENT_DIALOG_MAYBE) // wait, we CAN'T use it... - // and you need to be careful because you will change shooting settings while recording! - { - draw_line(720, 430, 680, 445, COLOR_WHITE); - draw_line(720, 431, 680, 446, COLOR_WHITE); - } - } - #endif - } - - // if there's a warning message set, display it - if (menu->selected && warning_msg) - { - bmp_printf( - FONT(FONT_MED, COLOR_WHITE, COLOR_BLACK), - 10, MENU_WARNING_Y_POS, - " " - ); - - bmp_printf( - FONT(FONT_MED, MENU_WARNING_COLOR, COLOR_BLACK), - 10, MENU_WARNING_Y_POS, - warning_msg - ); - } - - // if you have hidden some menus, display help about how to bring them back - if (advanced_hidden_edit_mode) - { - bmp_printf( - FONT(FONT_MED, MENU_WARNING_COLOR, COLOR_BLACK), - 10, MENU_HELP_Y_POS, - "Press SET to hide items that you don't use. MENU: go back. " - ); - } - - // display submenu marker if this item has a submenu - if (menu->children && !menu_lv_transparent_mode) - submenu_icon(x, y); - // display selection bar if (menu->selected) selection_bar(x, y); @@ -1461,12 +1474,12 @@ hidden_msg[59] = '\0'; } - int hidden_pos_y = MENU_KEYHELP_Y_POS - font_med.height - 5; + int hidden_pos_y = MENU_HELP_Y_POS - font_med.height - 5; if (is_menu_active("Help")) hidden_pos_y -= font_med.height; if (hidden_count || force_clear) { bmp_printf( - FONT(FONT_MED, COLOR_GRAY45, COLOR_BLACK), + FONT(FONT_MED, COLOR_GRAY45, COLOR_GRAY40), 10, hidden_pos_y, " " ); @@ -1474,7 +1487,7 @@ if (hidden_count) { bmp_printf( - FONT(FONT_MED, advanced_hidden_edit_mode ? MENU_WARNING_COLOR : COLOR_ORANGE , COLOR_BLACK), + FONT(FONT_MED, advanced_hidden_edit_mode ? MENU_WARNING_COLOR : COLOR_ORANGE , COLOR_GRAY40), 10, hidden_pos_y, hidden_msg ); @@ -1534,6 +1547,10 @@ bmp_fill(bgu, orig_x, y, 720, 42); bmp_fill(fgu, orig_x, y+42, 720, 1); + + bmp_fill(fgu, orig_x, 480-51, 720, 1); + bmp_fill(bgu, orig_x, 480-50, 720, 50); + for( ; menu ; menu = menu->next ) { if (!menu_has_visible_items(menu->children) && !menu->selected) @@ -1589,8 +1606,8 @@ menu_display( menu, - orig_x + 40, - y + 50, + orig_x + 20, + y + 60, 0 ); @@ -1607,8 +1624,8 @@ struct menu * menu = get_selected_menu(); menu_display( menu, - 40, - 50, + 20, + 60, 1 ); } @@ -1637,7 +1654,7 @@ } show_hidden_items(submenu, 1); - menu_display(submenu, bx + 50, by + 50 + 20, 0); + menu_display(submenu, bx + 20, by + 50 + 20, 0); } static void diff -r 1cefe7b4d017 src/menu.h --- a/src/menu.h Tue Jan 29 13:10:14 2013 +0200 +++ b/src/menu.h Tue Jan 29 17:41:09 2013 +0200 @@ -38,6 +38,7 @@ #define MENU_FONT FONT(FONT_LARGE,COLOR_WHITE,COLOR_BLACK) #define MENU_FONT_SEL MENU_FONT +#define MENU_FONT_GRAY FONT(FONT_LARGE,50,COLOR_BLACK) int get_menu_font_sel(); int gui_menu_shown(); @@ -83,14 +84,17 @@ const char * name; // used for context help and sometimes for display struct menu_entry * children; uint32_t id; // unique ID - // not required for entry item, but makes it easier to declare in existing menu structures - int16_t submenu_width; - int16_t submenu_height; - int16_t pos; - int16_t childnum; - int16_t childnummax; + int16_t submenu_width; // not required for entry item, + int16_t submenu_height; // but makes it easier to declare in existing menu structures + int8_t pos; + int8_t childnum; + int8_t childnummax; + int16_t depends_on; // hard requirement, won't work otherwise + int16_t works_best_in; // soft requirement, it will work, but not as well }; +#define IS_VISIBLE(menu) (menu->hidden != MENU_ENTRY_HIDDEN) + #define MENU_ENTRY_NOT_HIDDEN 0 #define MENU_ENTRY_HIDDEN 1 #define MENU_ENTRY_NEVER_HIDE -1 @@ -122,29 +126,19 @@ #define UNIT_ISO 5 #define UNIT_HEX 6 - -// these can be combined with OR -/* -#define FOR_MOVIE 1 -#define FOR_PHOTO 2 // LV + non-LV -#define FOR_LIVEVIEW 4 // photo and movie -#define FOR_PHOTO_NON_LIVEVIEW 8 // photo only, non_liveview -#define FOR_PLAYBACK 16 // photo and movie -#define FOR_EXT_MONITOR 32 // HDMI or SD -#define FOR_SUBMENU 64 -*/ -/* -#define IS_VISIBLE(menu) ( \ - (menu->essential & FOR_MOVIE && is_movie_mode() && lv) || \ - (menu->essential & FOR_PHOTO && !is_movie_mode() && !PLAY_MODE) || \ - (menu->essential & FOR_LIVEVIEW && lv) || \ - (menu->essential & FOR_PHOTO_NON_LIVEVIEW && !lv && !PLAY_MODE) || \ - (menu->essential & FOR_PLAYBACK && PLAY_MODE) || \ - (menu->essential & FOR_EXT_MONITOR && EXT_MONITOR_CONNECTED) || \ - (menu->essential & FOR_SUBMENU && submenu_mode) || \ -0) */ - -#define IS_VISIBLE(menu) (menu->hidden != MENU_ENTRY_HIDDEN) +#define DEP_GLOBAL_DRAW (1<<0) +#define DEP_LIVEVIEW (1<<1) +#define DEP_NOT_LIVEVIEW (1<<2) +#define DEP_MOVIE_MODE (1<<3) +#define DEP_PHOTO_MODE (1<<4) +#define DEP_AUTOFOCUS (1<<5) +#define DEP_MANUAL_FOCUS (1<<6) +#define DEP_CFN_AF_HALFSHUTTER (1<<7) +#define DEP_CFN_AF_BACK_BUTTON (1<<8) +#define DEP_EXPSIM (1<<9) +#define DEP_NOT_EXPSIM (1<<10) +#define DEP_CHIPPED_LENS (1<<11) +#define DEP_M_MODE (1<<12) struct menu { @@ -161,10 +155,33 @@ int16_t childnum; int16_t childnummax; int16_t delnum; + int name_width; }; #define IS_SUBMENU(menu) (menu->icon == ICON_ML_SUBMENU) +struct menu_display_info +{ + char* name; + char* value; + char* help; + char* warning; + int truth_value; + enum {W_ALRIGHT, W_BE_CAREFUL, W_GRAYED_OUT} + warning_level; + enum {CUSTOM_DRAW_DISABLE, CUSTOM_DRAW_THIS_ENTRY, CUSTOM_DRAW_THIS_MENU} + custom_drawing; +}; + +#define MENU_MAX_NAME_LEN 25 +#define MENU_MAX_VALUE_LEN 18 +#define MENU_MAX_HELP_LEN 60 +#define MENU_MAX_WARNING_LEN 60 + + + + + extern void menu_print( void * priv, @@ -224,9 +241,10 @@ #define _ZEBRAS_IN_LIVEVIEW (get_global_draw_setting() & 1) #define GDR_WARNING_MSG ((lv && lv_disp_mode && _ZEBRAS_IN_LIVEVIEW) ? "Press " INFO_BTN_NAME " (outside ML menu) to turn Canon displays off." : get_global_draw_setting() ? "GlobalDraw is disabled, check your settings." : "GlobalDraw is OFF.") +#define EXPSIM_WARNING_MSG (expsim == 0 ? "ExpSim is OFF." : "Display Gain is active.") // no other causes.. yet #define MNI_BOOL_GDR(x) ((x) ? ( get_global_draw() ? MNI_ON : MNI_WARNING ) : MNI_OFF), (intptr_t) GDR_WARNING_MSG -#define MNI_BOOL_GDR_EXPSIM(x) ((x) ? ( get_global_draw() && (lv_luma_is_accurate() || !lv) ? MNI_ON : MNI_WARNING ) : MNI_OFF), (intptr_t)( !get_global_draw() ? GDR_WARNING_MSG : expsim == 0 ? "ExpSim is OFF." : "Display Gain is active." ) +#define MNI_BOOL_GDR_EXPSIM(x) ((x) ? ( get_global_draw() && (lv_luma_is_accurate() || !lv) ? MNI_ON : MNI_WARNING ) : MNI_OFF), (intptr_t)( !get_global_draw() ? GDR_WARNING_MSG : EXPSIM_WARNING_MSG ) #define MNI_BOOL_LV(x) ((x) ? ( lv ? MNI_ON : MNI_WARNING ) : MNI_OFF), (intptr_t) "This option only works in LiveView." #define MENU_EOL_PRIV (void*)-1 diff -r 1cefe7b4d017 src/menuindexentries.h --- a/src/menuindexentries.h Tue Jan 29 13:10:14 2013 +0200 +++ b/src/menuindexentries.h Tue Jan 29 17:41:09 2013 +0200 @@ -44,10 +44,3 @@ .display = menu_print, //.essential = FOR_MOVIE | FOR_PHOTO, }, - { - .name = "Epilogue", - .priv = "Epilogue", - .select = menu_help_go_to_label, - .display = menu_print, - //.essential = FOR_MOVIE | FOR_PHOTO, - }, diff -r 1cefe7b4d017 src/movtweaks.c --- a/src/movtweaks.c Tue Jan 29 13:10:14 2013 +0200 +++ b/src/movtweaks.c Tue Jan 29 17:41:09 2013 +0200 @@ -1098,6 +1098,7 @@ .select_Q = lv_movie_size_toggle, .display = lv_movie_print, .help = "Enable movie recording on 50D :) ", + .depends_on = DEP_LIVEVIEW, }, #endif #ifdef FEATURE_MOVIE_RECORDING_50D_SHUTTER_HACK @@ -1107,6 +1108,7 @@ .display = shutter_btn_rec_print, .select = menu_ternary_toggle, .help = "Block it while REC (avoids ERR99) or hold it (enables IS).", + .depends_on = DEP_MOVIE_MODE, }, #endif #ifdef FEATURE_MOVIE_RESTART @@ -1116,6 +1118,7 @@ .display = movie_restart_print, .select = menu_binary_toggle, .help = "Auto-restart movie recording, if it happens to stop.", + .depends_on = DEP_MOVIE_MODE, }, #endif #ifdef FEATURE_MOVIE_AUTOSTOP_RECORDING @@ -1125,6 +1128,7 @@ .display = movie_cliplen_display, .select = movie_cliplen_toggle, .help = "Auto-stop the movie after a set amount of minutes.", + .depends_on = DEP_MOVIE_MODE, }, #endif #if 0 @@ -1152,6 +1156,7 @@ #endif .icon_type = IT_DICE_OFF, .help = "Custom REC/STANDBY notifications, visual or audible", + .depends_on = DEP_MOVIE_MODE, }, #endif #ifdef CONFIG_5D3 @@ -1160,6 +1165,7 @@ .priv = &rec_led_off, .max = 1, .help = "Make the red LED light less distracting while recording.", + .depends_on = DEP_MOVIE_MODE, }, #endif #ifdef FEATURE_MOVIE_REC_KEY @@ -1171,6 +1177,7 @@ .choices = (const char *[]) {"OFF", "HalfShutter"}, .help = "Start recording by pressing shutter halfway. Wired remote.", .submenu_width = 700, + .depends_on = DEP_MOVIE_MODE, .children = (struct menu_entry[]) { { .name = "Require long press", @@ -1200,6 +1207,7 @@ .choices = (const char *[]) {"OFF", "Start & CPU lenses", "Always"}, .icon_type = IT_DICE_OFF, .help = "Always use LiveView (with manual lens or after lens swap).", + .depends_on = DEP_MOVIE_MODE, }, #endif #ifdef FEATURE_LVAE_EXPO_LOCK @@ -1209,6 +1217,7 @@ .select = movie_expo_lock_toggle, .display = movie_expo_lock_print, .help = "Lock the exposure in movie mode.", + .depends_on = DEP_MOVIE_MODE, }, #endif #ifdef FEATURE_SHUTTER_LOCK @@ -1218,6 +1227,7 @@ .display = shutter_lock_print, .select = menu_binary_toggle, .help = "Lock shutter value in movie mode (change from Expo only).", + .depends_on = DEP_MOVIE_MODE, }, #endif #ifdef FEATURE_GRADUAL_EXPOSURE @@ -1227,6 +1237,7 @@ .max = 1, .help = "Use smooth exposure transitions, by compensating with ISO.", .submenu_width = 700, + .depends_on = DEP_MOVIE_MODE, .children = (struct menu_entry[]) { { .name = "Ramping speed", @@ -1247,7 +1258,8 @@ .priv = &start_recording_on_resume, .max = 1, .help = "Auto-record if camera wakes up due to halfshutter press." - }, + .depends_on = DEP_MOVIE_MODE, + }, #endif }; @@ -1258,6 +1270,7 @@ .select = bv_toggle, .display = bv_display, .help = "Low-level manual exposure controls (bypasses Canon limits)", + .depends_on = DEP_LIVEVIEW, }, }; #endif diff -r 1cefe7b4d017 src/shoot.c --- a/src/shoot.c Tue Jan 29 13:10:14 2013 +0200 +++ b/src/shoot.c Tue Jan 29 17:41:09 2013 +0200 @@ -4817,7 +4817,7 @@ .display = hdr_display, .select = menu_binary_toggle, .help = "Advanced bracketing (expo, flash, DOF). Press shutter once.", - //.essential = FOR_PHOTO, + .works_best_in = DEP_PHOTO_MODE, .submenu_width = 710, .children = (struct menu_entry[]) { { @@ -4891,7 +4891,7 @@ .display = intervalometer_display, .help = "Take pictures or movies at fixed intervals (for timelapse).", .submenu_width = 650, - //.essential = FOR_PHOTO, + .works_best_in = DEP_PHOTO_MODE, .children = (struct menu_entry[]) { { .name = "Take a pic every", @@ -4923,6 +4923,7 @@ .choices = (const char *[]) {"NO", "YES"}, .help = "Whether the camera should auto-focus at each shot.", .icon_type = IT_DISABLE_SOME_FEATURE_NEG, + .depends_on = DEP_AUTOFOCUS, }, #endif MENU_EOL @@ -4943,6 +4944,7 @@ .max = 1, .submenu_width = 710, .help = "Exposure / focus ramping for advanced timelapse sequences.", + .depends_on = DEP_PHOTO_MODE, .children = (struct menu_entry[]) { { .name = "Auto ExpoRamp\b", @@ -4998,6 +5000,7 @@ .min = 1000-100, .display = manual_focus_ramp_print, .help = "Manual focus ramping, in steps per shot. LiveView only.", + .depends_on = DEP_AUTOFOCUS, }, MENU_EOL, } @@ -5010,7 +5013,7 @@ .display = bulb_display, .select = menu_binary_toggle, .help = "For very long exposures. Hold shutter half-pressed for 1s.", - //.essential = FOR_PHOTO, + .depends_on = DEP_PHOTO_MODE, .children = (struct menu_entry[]) { { .name = "Bulb exposure", @@ -5063,7 +5066,7 @@ .select = menu_binary_toggle, .display = motion_detect_display, .help = "Take a picture when subject is moving or exposure changes.", - //.essential = FOR_PHOTO, + .works_best_in = DEP_LIVEVIEW, .submenu_width = 650, .children = (struct menu_entry[]) { { @@ -5118,6 +5121,7 @@ .priv = &silent_pic_enabled, .select = menu_binary_toggle, .display = silent_pic_display, + .depends_on = DEP_LIVEVIEW, .help = "Take pics in LiveView without moving the shutter mechanism.", .children = (struct menu_entry[]) { { @@ -5168,6 +5172,7 @@ .priv = &mlu_auto, .display = mlu_display, .select = mlu_toggle, + .depends_on = DEP_PHOTO_MODE | DEP_NOT_LIVEVIEW, #ifdef FEATURE_MLU_HANDHELD .help = "MLU tricks: hand-held or self-timer modes.", #elif defined(CONFIG_5DC) @@ -5256,6 +5261,7 @@ .name = "Flash tweaks...", .select = menu_open_submenu, .help = "Flash exposure compensation, 3rd party flash in LiveView...", + .depends_on = DEP_PHOTO_MODE, .children = (struct menu_entry[]) { { .name = "Flash expo comp.", @@ -5655,9 +5661,8 @@ .display = aperture_display, .select = aperture_toggle, .help = "Adjust aperture. Also displays APEX aperture (Av) in stops.", - //.essential = FOR_PHOTO | FOR_MOVIE, + .depends_on = DEP_CHIPPED_LENS, .edit_mode = EM_MANY_VALUES_LV, - //~ .show_liveview = 1, }, #endif #ifdef FEATURE_PICSTYLE @@ -5727,7 +5732,7 @@ .select = picstyle_rec_toggle, .help = "You can use a different picture style when recording.", .submenu_height = 160, - //~ //.essential = FOR_MOVIE, + .depends_on = DEP_MOVIE_MODE, .children = (struct menu_entry[]) { { .name = "REC-PicStyle", @@ -5748,6 +5753,7 @@ .choices = (const char *[]) {"OFF", "ON (Tv/Av only)"}, .help = "Experimental auto ISO algorithms.", .submenu_width = 700, + .depends_on = DEP_PHOTO_MODE, .children = (struct menu_entry[]) { { .name = "Shutter for Av mode ", @@ -5787,6 +5793,7 @@ .max = 1, .display = expo_lock_display, .help = "In M mode, adjust Tv/Av/ISO without changing exposure.", + .depends_on = DEP_M_MODE, .children = (struct menu_entry[]) { { .name = "Tv -> ", @@ -5823,6 +5830,7 @@ .max = 2, .choices = (const char *[]) {"OFF", "Press SET", "Press " INFO_BTN_NAME}, .help = "Quickly toggle between two expo presets (ISO,Tv,Av,Kelvin).", + .works_best_in = DEP_M_MODE, }, #endif }; diff -r 1cefe7b4d017 src/tweaks.c --- a/src/tweaks.c Tue Jan 29 13:10:14 2013 +0200 +++ b/src/tweaks.c Tue Jan 29 17:41:09 2013 +0200 @@ -2680,6 +2680,7 @@ .max = 2, .icon_type = IT_DICE, .help = "Photo / Photo ExpSim / Movie. ExpSim: show proper exposure.", + .depends_on = DEP_LIVEVIEW, }, }; #endif @@ -3690,6 +3691,7 @@ .help = "For LiveView preview only. Does not affect recording.", .display = preview_brightness_display, .edit_mode = EM_MANY_VALUES_LV, + .depends_on = DEP_LIVEVIEW, }, { .name = "LV contrast", @@ -3698,6 +3700,7 @@ .display = preview_contrast_display, .help = "For LiveView preview only. Does not affect recording.", .edit_mode = EM_MANY_VALUES_LV, + .depends_on = DEP_LIVEVIEW, }, #endif #ifdef FEATURE_LV_SATURATION @@ -3709,6 +3712,7 @@ .help = "For LiveView preview only. Does not affect recording.", .edit_mode = EM_MANY_VALUES_LV, .submenu_width = 650, + .depends_on = DEP_LIVEVIEW, .children = (struct menu_entry[]) { { .name = "Boost when adjusting WB", @@ -3727,6 +3731,7 @@ .select = display_gain_toggle, .help = "Boost LiveView display gain, for night vision (photo mode).", .edit_mode = EM_MANY_VALUES_LV, + .depends_on = DEP_LIVEVIEW, }, #endif #ifdef FEATURE_COLOR_SCHEME @@ -3769,6 +3774,7 @@ .priv = &display_shake, .max = 1, .help = "Emphasizes camera shake on LiveView display.", + .depends_on = DEP_LIVEVIEW, }, #endif #ifdef FEATURE_DEFISHING_PREVIEW @@ -3810,6 +3816,7 @@ .max = 1, .submenu_width = 700, .help = "Stretches LiveView image vertically, for anamorphic lenses.", + .depends_on = DEP_LIVEVIEW, .children = (struct menu_entry[]) { { .name = "Stretch Ratio", @@ -3845,8 +3852,7 @@ .display = screen_layout_display, .select = screen_layout_toggle, .help = "Position of top/bottom bars, useful for external displays.", - //.essential = FOR_EXT_MONITOR, - //~ .edit_mode = EM_MANY_VALUES, + .depends_on = DEP_LIVEVIEW, }, #endif #ifdef FEATURE_IMAGE_POSITION diff -r 1cefe7b4d017 src/video_hacks.c --- a/src/video_hacks.c Tue Jan 29 13:10:14 2013 +0200 +++ b/src/video_hacks.c Tue Jan 29 17:41:09 2013 +0200 @@ -151,6 +151,7 @@ .priv = &bitrate_cache_hacks, .max = 1, .help = "Experimental hacks: flush rate, GOP size. Be careful!", + .depends_on = DEP_MOVIE_MODE, .children = (struct menu_entry[]) { { .name = "Flush rate", diff -r 1cefe7b4d017 src/zebra.c --- a/src/zebra.c Tue Jan 29 13:10:14 2013 +0200 +++ b/src/zebra.c Tue Jan 29 17:41:09 2013 +0200 @@ -3408,8 +3408,8 @@ .priv = &zebra_draw, .select = menu_binary_toggle, .display = zebra_draw_display, + .depends_on = DEP_GLOBAL_DRAW | DEP_EXPSIM, .help = "Zebra stripes: show overexposed or underexposed areas.", - //.essential = FOR_LIVEVIEW | FOR_PLAYBACK, .children = (struct menu_entry[]) { { .name = "Color space", @@ -3468,7 +3468,7 @@ .select = menu_binary_toggle, .help = "Show which parts of the image are in focus.", .submenu_width = 650, - //.essential = FOR_LIVEVIEW, + .depends_on = DEP_GLOBAL_DRAW, .children = (struct menu_entry[]) { { .name = "Filter bias", @@ -3546,7 +3546,7 @@ .max = 1, .help = "Zoom box for checking focus. Can be used while recording.", .submenu_width = 650, - //.essential = FOR_LIVEVIEW, + .depends_on = DEP_GLOBAL_DRAW | DEP_LIVEVIEW, .children = (struct menu_entry[]) { { .name = "Trigger mode", @@ -3618,7 +3618,7 @@ .display = crop_display, .select = menu_binary_toggle, .help = "Cropmarks or custom grids for framing.", - //.essential = FOR_LIVEVIEW, + .depends_on = DEP_GLOBAL_DRAW, .submenu_width = 650, .submenu_height = 270, .children = (struct menu_entry[]) { @@ -3656,7 +3656,7 @@ .display = transparent_overlay_display, .select = menu_binary_toggle, .help = "Overlay any image in LiveView. In PLAY mode, press LV btn.", - //.essential = FOR_PLAYBACK, + .depends_on = DEP_GLOBAL_DRAW | DEP_LIVEVIEW, }, #endif #ifdef FEATURE_SPOTMETER @@ -3666,7 +3666,7 @@ .select = menu_binary_toggle, .display = spotmeter_menu_display, .help = "Exposure aid: display brightness from a small spot.", - //.essential = FOR_LIVEVIEW | FOR_PLAYBACK, + .depends_on = DEP_GLOBAL_DRAW | DEP_EXPSIM, .children = (struct menu_entry[]) { { .name = "Unit", @@ -3696,7 +3696,7 @@ .select = menu_binary_toggle, .submenu_height = 160, .help = "Exposure aid: each brightness level is color-coded.", - //.essential = FOR_LIVEVIEW | FOR_PLAYBACK, + .depends_on = DEP_GLOBAL_DRAW | DEP_EXPSIM, .children = (struct menu_entry[]) { { .name = "Palette", @@ -3717,7 +3717,7 @@ .max = 1, .display = hist_print, .help = "Exposure aid: shows the distribution of brightness levels.", - //.essential = FOR_LIVEVIEW | FOR_PLAYBACK, + .depends_on = DEP_GLOBAL_DRAW | DEP_EXPSIM, .children = (struct menu_entry[]) { { .name = "Color space", @@ -3752,6 +3752,7 @@ .display = waveform_print, .max = 1, .help = "Exposure aid: useful for checking overall brightness.", + .depends_on = DEP_GLOBAL_DRAW | DEP_EXPSIM, .children = (struct menu_entry[]) { { .name = "Size", @@ -3773,7 +3774,7 @@ .priv = &vectorscope_draw, .max = 1, .help = "Shows color distribution as U-V plot. For grading & WB.", - //.essential = FOR_LIVEVIEW, + .depends_on = DEP_GLOBAL_DRAW | DEP_EXPSIM, }, #endif }; @@ -3787,6 +3788,7 @@ .select = menu_binary_toggle, .display = electronic_level_display, .help = "Electronic level indicator in 0.5 degree steps.", + .depends_on = DEP_GLOBAL_DRAW, }, #endif #endif