Changeset 988
- Timestamp:
- 11/28/10 03:11:43 (3 years ago)
- File:
-
- 1 edited
-
trunk/core/gui.c (modified) (26 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/core/gui.c
r987 r988 1007 1007 #endif 1008 1008 1009 /* 1010 common code for "enum" menu items that just take a list of string values and don't require any special setters 1011 would be better to have another menu item type that does this by default 1012 save memory by eliminating dupe code 1013 */ 1014 static void gui_enum_value_change(int *value, int change, unsigned num_items) { 1015 *value+=change; 1016 if (*value<0) 1017 *value = num_items-1; 1018 else if (*value>=num_items) 1019 *value = 0; 1020 } 1021 static const char* gui_change_simple_enum(int* value, int change, const char** items, unsigned num_items) { 1022 gui_enum_value_change(value, change, num_items); 1023 return items[*value]; 1024 } 1009 1025 1010 1026 //------------------------------------------------------------------- … … 1013 1029 static const char* modes[]={ "None", "Custom", "+1EV", "+2EV", "Auto DR" }; 1014 1030 1015 conf.curve_enable+=change; 1016 if (conf.curve_enable<0) 1017 conf.curve_enable=(sizeof(modes)/sizeof(modes[0]))-1; 1018 else if (conf.curve_enable>=(sizeof(modes)/sizeof(modes[0]))) 1019 conf.curve_enable=0; 1031 gui_enum_value_change(&conf.curve_enable,change,sizeof(modes)/sizeof(modes[0])); 1020 1032 1021 1033 if(change) … … 1027 1039 const char* gui_script_autostart_enum(int change, int arg) { 1028 1040 static const char* modes[]={ "Off", "On", "Once"}; 1029 1030 conf.script_startup+=change; 1031 if (conf.script_startup<0) 1032 conf.script_startup=(sizeof(modes)/sizeof(modes[0]))-1; 1033 else if (conf.script_startup>=(sizeof(modes)/sizeof(modes[0]))) 1034 conf.script_startup=0; 1035 1036 return modes[conf.script_startup]; 1041 return gui_change_simple_enum(&conf.script_startup,change,modes,sizeof(modes)/sizeof(modes[0])); 1037 1042 } 1038 1043 … … 1045 1050 save_params_values(0); 1046 1051 } 1047 conf.script_param_set += change; 1048 if (conf.script_param_set < 0) 1049 conf.script_param_set = (sizeof(modes)/sizeof(modes[0]))-1; 1050 else if (conf.script_param_set >= (sizeof(modes)/sizeof(modes[0]))) 1051 conf.script_param_set=0; 1052 gui_enum_value_change(&conf.script_param_set,change,sizeof(modes)/sizeof(modes[0])); 1052 1053 1053 1054 if (!load_params_values(conf.script_file, 1, 0)) … … 1063 1064 const char* gui_override_disable_enum(int change, int arg) { 1064 1065 static const char* modes[]={ "Off", "On", "Disabled"}; 1065 1066 conf.override_disable+=change; 1067 if (conf.override_disable<0) 1068 conf.override_disable=(sizeof(modes)/sizeof(modes[0]))-1; 1069 else if (conf.override_disable>=(sizeof(modes)/sizeof(modes[0]))) 1070 conf.override_disable=0; 1071 1072 return modes[conf.override_disable]; 1066 return gui_change_simple_enum(&conf.override_disable,change,modes,sizeof(modes)/sizeof(modes[0])); 1073 1067 } 1074 1068 … … 1077 1071 static const char* modes[]={ "Linear", "Log" }; 1078 1072 1079 conf.histo_mode+=change; 1080 if (conf.histo_mode<0) 1081 conf.histo_mode=(sizeof(modes)/sizeof(modes[0]))-1; 1082 else if (conf.histo_mode>=(sizeof(modes)/sizeof(modes[0]))) 1083 conf.histo_mode=0; 1073 gui_enum_value_change(&conf.histo_mode,change,sizeof(modes)/sizeof(modes[0])); 1084 1074 1085 1075 histogram_set_mode(conf.histo_mode); … … 1091 1081 const char* gui_temp_mode_enum(int change, int arg) { 1092 1082 static const char* modes[]={ "Off", "Optical","CCD","Battery","all" }; 1093 1094 conf.show_temp+=change; 1095 if (conf.show_temp<0) 1096 conf.show_temp=(sizeof(modes)/sizeof(modes[0]))-1; 1097 else if (conf.show_temp>=(sizeof(modes)/sizeof(modes[0]))) 1098 conf.show_temp=0; 1099 1100 return modes[conf.show_temp]; 1083 return gui_change_simple_enum(&conf.show_temp,change,modes,sizeof(modes)/sizeof(modes[0])); 1101 1084 } 1102 1085 … … 1105 1088 static const char* modes[]={ "RGB", "Y", "RGB Y", "R G B", "RGB all", "Y all", "Blend", "Blend Y"}; 1106 1089 1107 conf.histo_layout+=change; 1108 if (conf.histo_layout<0) 1109 conf.histo_layout=(sizeof(modes)/sizeof(modes[0]))-1; 1110 else if (conf.histo_layout>=(sizeof(modes)/sizeof(modes[0]))) 1111 conf.histo_layout=0; 1090 gui_enum_value_change(&conf.histo_layout,change,sizeof(modes)/sizeof(modes[0])); 1112 1091 1113 1092 if (conf.histo_layout==OSD_HISTO_LAYOUT_Y || conf.histo_layout==OSD_HISTO_LAYOUT_Y_argb) { … … 1124 1103 static const char* fonts[]={ "Win1250", "Win1251", "Win1252", "Win1253", "Win1254", "Win1257"}; 1125 1104 1126 conf.font_cp+=change; 1127 if (conf.font_cp<0) 1128 conf.font_cp=(sizeof(fonts)/sizeof(fonts[0]))-1; 1129 else if (conf.font_cp>=(sizeof(fonts)/sizeof(fonts[0]))) 1130 conf.font_cp=0; 1105 gui_enum_value_change(&conf.font_cp,change,sizeof(fonts)/sizeof(fonts[0])); 1131 1106 1132 1107 if (change != 0) { … … 1143 1118 //------------------------------------------------------------------- 1144 1119 const char* gui_raw_prefix_enum(int change, int arg) { 1145 conf.raw_prefix+=change; 1146 if (conf.raw_prefix<0) 1147 conf.raw_prefix=NUM_IMG_PREFIXES-1; 1148 else if (conf.raw_prefix>=NUM_IMG_PREFIXES) 1149 conf.raw_prefix=0; 1150 1151 return img_prefixes[conf.raw_prefix]; 1120 return gui_change_simple_enum(&conf.raw_prefix,change,img_prefixes,NUM_IMG_PREFIXES); 1152 1121 } 1153 1122 1154 1123 //------------------------------------------------------------------- 1155 1124 const char* gui_raw_ext_enum(int change, int arg) { 1156 conf.raw_ext+=change; 1157 if (conf.raw_ext<0) 1158 conf.raw_ext=NUM_IMG_EXTS-1; 1159 else if (conf.raw_ext>=NUM_IMG_EXTS) 1160 conf.raw_ext=0; 1161 1162 return img_exts[conf.raw_ext]; 1125 return gui_change_simple_enum(&conf.raw_ext,change,img_exts,NUM_IMG_EXTS); 1163 1126 } 1164 1127 1165 1128 //------------------------------------------------------------------- 1166 1129 const char* gui_sub_batch_prefix_enum(int change, int arg) { 1167 conf.sub_batch_prefix+=change; 1168 if (conf.sub_batch_prefix<0) 1169 conf.sub_batch_prefix=NUM_IMG_PREFIXES-1; 1170 else if (conf.sub_batch_prefix>=NUM_IMG_PREFIXES) 1171 conf.sub_batch_prefix=0; 1172 1173 return img_prefixes[conf.sub_batch_prefix]; 1130 return gui_change_simple_enum(&conf.sub_batch_prefix,change,img_prefixes,NUM_IMG_PREFIXES); 1174 1131 } 1175 1132 1176 1133 //------------------------------------------------------------------- 1177 1134 const char* gui_sub_batch_ext_enum(int change, int arg) { 1178 conf.sub_batch_ext+=change; 1179 if (conf.sub_batch_ext<0) 1180 conf.sub_batch_ext=NUM_IMG_EXTS-1; 1181 else if (conf.sub_batch_ext>=NUM_IMG_EXTS) 1182 conf.sub_batch_ext=0; 1183 1184 return img_exts[conf.sub_batch_ext]; 1135 return gui_change_simple_enum(&conf.sub_batch_ext,change,img_exts,NUM_IMG_EXTS); 1185 1136 } 1186 1137 … … 1188 1139 const char* gui_raw_nr_enum(int change, int arg) { 1189 1140 static const char* modes[]={ "Auto", "Off", "On"}; 1190 1191 conf.raw_nr+=change; 1192 if (conf.raw_nr<0) 1193 conf.raw_nr=(sizeof(modes)/sizeof(modes[0]))-1; 1194 else if (conf.raw_nr>=(sizeof(modes)/sizeof(modes[0]))) 1195 conf.raw_nr=0; 1196 1197 return modes[conf.raw_nr]; 1141 return gui_change_simple_enum(&conf.raw_nr,change,modes,sizeof(modes)/sizeof(modes[0])); 1198 1142 } 1199 1143 … … 1202 1146 const char* gui_reader_codepage_enum(int change, int arg) { 1203 1147 static const char* cps[]={ "Win1251", "DOS"}; 1204 1205 conf.reader_codepage+=change; 1206 if (conf.reader_codepage<0) 1207 conf.reader_codepage=(sizeof(cps)/sizeof(cps[0]))-1; 1208 else if (conf.reader_codepage>=(sizeof(cps)/sizeof(cps[0]))) 1209 conf.reader_codepage=0; 1210 1211 return cps[conf.reader_codepage]; 1148 return gui_change_simple_enum(&conf.reader_codepage,change,cps,sizeof(cps)/sizeof(cps[0])); 1212 1149 } 1213 1150 #endif … … 1215 1152 const char* gui_autoiso_shutter_enum(int change, int arg) { 1216 1153 static const char* shutter[]={ "Auto", "1/8s", "1/15s", "1/30s", "1/60s", "1/125s", "1/250s", "1/500s", "1/1000s"}; 1217 1218 conf.autoiso_shutter+=change; 1219 if (conf.autoiso_shutter<0) 1220 conf.autoiso_shutter=(sizeof(shutter)/sizeof(shutter[0]))-1; 1221 else if (conf.autoiso_shutter>=(sizeof(shutter)/sizeof(shutter[0]))) 1222 conf.autoiso_shutter=0; 1223 1224 return shutter[conf.autoiso_shutter]; 1154 return gui_change_simple_enum(&conf.autoiso_shutter,change,shutter,sizeof(shutter)/sizeof(shutter[0])); 1225 1155 } 1226 1156 … … 1228 1158 const char* gui_zebra_mode_enum(int change, int arg) { 1229 1159 static const char* modes[]={ "Blink 1", "Blink 2", "Blink 3", "Solid", "Zebra 1", "Zebra 2" }; 1230 1231 conf.zebra_mode+=change; 1232 if (conf.zebra_mode<0) 1233 conf.zebra_mode=(sizeof(modes)/sizeof(modes[0]))-1; 1234 else if (conf.zebra_mode>=(sizeof(modes)/sizeof(modes[0]))) 1235 conf.zebra_mode=0; 1236 1237 return modes[conf.zebra_mode]; 1160 return gui_change_simple_enum(&conf.zebra_mode,change,modes,sizeof(modes)/sizeof(modes[0])); 1238 1161 } 1239 1162 … … 1241 1164 const char* gui_zebra_draw_osd_enum(int change, int arg) { 1242 1165 static const char* modes[]={ "Nothing", "Histo", "OSD" }; 1243 1244 conf.zebra_draw_osd+=change; 1245 if (conf.zebra_draw_osd<0) 1246 conf.zebra_draw_osd=(sizeof(modes)/sizeof(modes[0]))-1; 1247 else if (conf.zebra_draw_osd>=(sizeof(modes)/sizeof(modes[0]))) 1248 conf.zebra_draw_osd=0; 1249 1250 return modes[conf.zebra_draw_osd]; 1166 return gui_change_simple_enum(&conf.zebra_draw_osd,change,modes,sizeof(modes)/sizeof(modes[0])); 1251 1167 } 1252 1168 … … 1254 1170 const char* gui_zoom_value_enum(int change, int arg) { 1255 1171 static const char* modes[]={ "X", "FL", "EFL" }; 1256 1257 conf.zoom_value+=change; 1258 if (conf.zoom_value<0) 1259 conf.zoom_value=(sizeof(modes)/sizeof(modes[0]))-1; 1260 else if (conf.zoom_value>=(sizeof(modes)/sizeof(modes[0]))) 1261 conf.zoom_value=0; 1262 1263 return modes[conf.zoom_value]; 1172 return gui_change_simple_enum(&conf.zoom_value,change,modes,sizeof(modes)/sizeof(modes[0])); 1264 1173 } 1265 1174 1266 1175 const char* gui_show_values_enum(int change, int arg) { 1267 1176 static const char* modes[]={ "Don't", "Always", "Shoot" }; 1268 1269 conf.show_values+=change; 1270 if (conf.show_values<0) 1271 conf.show_values=(sizeof(modes)/sizeof(modes[0]))-1; 1272 else if (conf.show_values>=(sizeof(modes)/sizeof(modes[0]))) 1273 conf.show_values=0; 1274 1275 return modes[conf.show_values]; 1177 return gui_change_simple_enum(&conf.show_values,change,modes,sizeof(modes)/sizeof(modes[0])); 1276 1178 } 1277 1179 1278 1180 const char* gui_nd_filter_state_enum(int change, int arg) { 1279 1181 static const char* modes[]={ "Off", "In", "Out" }; 1280 1281 conf.nd_filter_state+=change; 1282 if (conf.nd_filter_state<0) 1283 conf.nd_filter_state=(sizeof(modes)/sizeof(modes[0]))-1; 1284 else if (conf.nd_filter_state>=(sizeof(modes)/sizeof(modes[0]))) 1285 conf.nd_filter_state=0; 1286 1287 return modes[conf.nd_filter_state]; 1288 } 1289 1290 1182 return gui_change_simple_enum(&conf.nd_filter_state,change,modes,sizeof(modes)/sizeof(modes[0])); 1183 } 1291 1184 1292 1185 const char* gui_dof_show_value_enum(int change, int arg) { 1293 1186 static const char* modes[]={ "Don't", "Separate", "In Misc" }; 1294 1295 conf.show_dof+=change; 1296 if (conf.show_dof<0) 1297 conf.show_dof=(sizeof(modes)/sizeof(modes[0]))-1; 1298 else if (conf.show_dof>=(sizeof(modes)/sizeof(modes[0]))) 1299 conf.show_dof=0; 1300 1301 return modes[conf.show_dof]; 1302 } 1303 1187 return gui_change_simple_enum(&conf.show_dof,change,modes,sizeof(modes)/sizeof(modes[0])); 1188 } 1304 1189 1305 1190 const char* gui_histo_show_enum(int change, int arg) { 1306 1191 static const char* modes[]={ "Don't", "Always", "Shoot" }; 1307 1308 conf.show_histo+=change; 1309 if (conf.show_histo<0) 1310 conf.show_histo=(sizeof(modes)/sizeof(modes[0]))-1; 1311 else if (conf.show_histo>=(sizeof(modes)/sizeof(modes[0]))) 1312 conf.show_histo=0; 1313 1314 return modes[conf.show_histo]; 1192 return gui_change_simple_enum(&conf.show_histo,change,modes,sizeof(modes)/sizeof(modes[0])); 1315 1193 } 1316 1194 1317 1195 const char* gui_show_clock_enum(int change, int arg) { 1318 1196 static const char* modes[]={ "Don't", "Normal", "Seconds"}; 1319 1320 conf.show_clock+=change; 1321 if (conf.show_clock<0) 1322 conf.show_clock=(sizeof(modes)/sizeof(modes[0]))-1; 1323 else if (conf.show_clock>=(sizeof(modes)/sizeof(modes[0]))) 1324 conf.show_clock=0; 1325 1326 return modes[conf.show_clock]; 1197 return gui_change_simple_enum(&conf.show_clock,change,modes,sizeof(modes)/sizeof(modes[0])); 1327 1198 } 1328 1199 1329 1200 const char* gui_hide_osd_enum(int change, int arg) { 1330 1201 static const char* modes[]={ "Don't", "In Playback", "On Disp Press", "both"}; 1331 1332 conf.hide_osd+=change; 1333 if (conf.hide_osd<0) 1334 conf.hide_osd=(sizeof(modes)/sizeof(modes[0]))-1; 1335 else if (conf.hide_osd>=(sizeof(modes)/sizeof(modes[0]))) 1336 conf.hide_osd=0; 1337 1338 return modes[conf.hide_osd]; 1202 return gui_change_simple_enum(&conf.hide_osd,change,modes,sizeof(modes)/sizeof(modes[0])); 1339 1203 } 1340 1204 1341 1205 const char* gui_clock_format_enum(int change, int arg) { 1342 1206 static const char* modes[]={ "24h", "12h"}; 1343 1344 conf.clock_format+=change; 1345 if (conf.clock_format<0) 1346 conf.clock_format=(sizeof(modes)/sizeof(modes[0]))-1; 1347 else if (conf.clock_format>=(sizeof(modes)/sizeof(modes[0]))) 1348 conf.clock_format=0; 1349 1350 return modes[conf.clock_format]; 1207 return gui_change_simple_enum(&conf.clock_format,change,modes,sizeof(modes)/sizeof(modes[0])); 1351 1208 } 1352 1209 1353 1210 const char* gui_clock_indicator_enum(int change, int arg) { 1354 1211 static const char* modes[]={ "PM", "P","."}; 1355 1356 conf.clock_indicator+=change; 1357 if (conf.clock_indicator<0) 1358 conf.clock_indicator=(sizeof(modes)/sizeof(modes[0]))-1; 1359 else if (conf.clock_indicator>=(sizeof(modes)/sizeof(modes[0]))) 1360 conf.clock_indicator=0; 1361 1362 return modes[conf.clock_indicator]; 1212 return gui_change_simple_enum(&conf.clock_indicator,change,modes,sizeof(modes)/sizeof(modes[0])); 1363 1213 } 1364 1214 1365 1215 const char* gui_clock_halfpress_enum(int change, int arg) { 1366 1216 static const char* modes[]={ "Full", "Seconds","Don't"}; 1367 1368 conf.clock_halfpress+=change; 1369 if (conf.clock_halfpress<0) 1370 conf.clock_halfpress=(sizeof(modes)/sizeof(modes[0]))-1; 1371 else if (conf.clock_halfpress>=(sizeof(modes)/sizeof(modes[0]))) 1372 conf.clock_halfpress=0; 1373 1374 return modes[conf.clock_halfpress]; 1217 return gui_change_simple_enum(&conf.clock_halfpress,change,modes,sizeof(modes)/sizeof(modes[0])); 1375 1218 } 1376 1219 1377 1220 const char* gui_space_bar_enum(int change, int arg) { 1378 1221 static const char* modes[]={ "Don't", "Horizontal", "Vertical"}; 1379 1380 conf.space_bar_show+=change; 1381 if (conf.space_bar_show<0) 1382 conf.space_bar_show=(sizeof(modes)/sizeof(modes[0]))-1; 1383 else if (conf.space_bar_show>=(sizeof(modes)/sizeof(modes[0]))) 1384 conf.space_bar_show=0; 1385 1386 return modes[conf.space_bar_show]; 1222 return gui_change_simple_enum(&conf.space_bar_show,change,modes,sizeof(modes)/sizeof(modes[0])); 1387 1223 } 1388 1224 1389 1225 const char* gui_space_bar_size_enum(int change, int arg) { 1390 1226 static const char* modes[]={ "1/4", "1/2", "1"}; 1391 1392 conf.space_bar_size+=change; 1393 if (conf.space_bar_size<0) 1394 conf.space_bar_size=(sizeof(modes)/sizeof(modes[0]))-1; 1395 else if (conf.space_bar_size>=(sizeof(modes)/sizeof(modes[0]))) 1396 conf.space_bar_size=0; 1397 1398 return modes[conf.space_bar_size]; 1227 return gui_change_simple_enum(&conf.space_bar_size,change,modes,sizeof(modes)/sizeof(modes[0])); 1399 1228 } 1400 1229 1401 1230 const char* gui_space_bar_width_enum(int change, int arg) { 1402 1231 static const char* modes[]={ "1", "2", "3","4","5","6","7","8","9","10"}; 1403 1404 conf.space_bar_width+=change; 1405 if (conf.space_bar_width<0) 1406 conf.space_bar_width=(sizeof(modes)/sizeof(modes[0]))-1; 1407 else if (conf.space_bar_width>=(sizeof(modes)/sizeof(modes[0]))) 1408 conf.space_bar_width=0; 1409 1410 return modes[conf.space_bar_width]; 1232 return gui_change_simple_enum(&conf.space_bar_width,change,modes,sizeof(modes)/sizeof(modes[0])); 1411 1233 } 1412 1234 1413 1235 const char* gui_space_warn_type_enum(int change, int arg) { 1414 1236 static const char* modes[]={ "Percent", "MB", "Don't"}; 1415 1416 conf.space_warn_type+=change; 1417 if (conf.space_warn_type<0) 1418 conf.space_warn_type=(sizeof(modes)/sizeof(modes[0]))-1; 1419 else if (conf.space_warn_type>=(sizeof(modes)/sizeof(modes[0]))) 1420 conf.space_warn_type=0; 1421 1422 return modes[conf.space_warn_type]; 1423 } 1424 1425 const char* gui_show_movie_time(int change, int arg) { 1426 static const char* modes[]={ "Don't", "hh:mm:ss", "KB/s","both"}; 1427 1428 conf.show_movie_time+=change; 1429 if (conf.show_movie_time<0) 1430 conf.show_movie_time=(sizeof(modes)/sizeof(modes[0]))-1; 1431 else if (conf.show_movie_time>=(sizeof(modes)/sizeof(modes[0]))) 1432 conf.show_movie_time=0; 1433 1434 return modes[conf.show_movie_time]; 1435 } 1237 return gui_change_simple_enum(&conf.space_warn_type,change,modes,sizeof(modes)/sizeof(modes[0])); 1238 } 1239 1240 const char* gui_show_movie_time(int change, int arg) { 1241 static const char* modes[]={ "Don't", "hh:mm:ss", "KB/s","both"}; 1242 return gui_change_simple_enum(&conf.show_movie_time,change,modes,sizeof(modes)/sizeof(modes[0])); 1243 } 1436 1244 1437 1245 //------------------------------------------------------------------- … … 1485 1293 const char* gui_alt_power_enum(int change, int arg) { 1486 1294 static const char* modes[]={ "Never", "Alt", "Script","Always" }; 1487 1488 conf.alt_prevent_shutdown+=change; 1489 if (conf.alt_prevent_shutdown<0) 1490 conf.alt_prevent_shutdown=(sizeof(modes)/sizeof(modes[0]))-1; 1491 else if (conf.alt_prevent_shutdown>=(sizeof(modes)/sizeof(modes[0]))) 1492 conf.alt_prevent_shutdown=0; 1295 gui_enum_value_change(&conf.alt_prevent_shutdown,change,sizeof(modes)/sizeof(modes[0])); 1493 1296 1494 1297 conf_update_prevent_shutdown(); … … 1498 1301 const char* gui_fast_ev_step(int change, int arg) { 1499 1302 static const char* modes[]={"1/6 Ev","1/3 Ev","1/2 Ev", "2/3 Ev","5/6 Ev","1 Ev","1 1/6 Ev","1 1/3 Ev","1 1/2 Ev", "1 2/3 Ev","1 5/6 Ev","2 Ev","2 1/6 Ev","2 1/3 Ev","2 1/2 Ev", "2 2/3 Ev","2 5/6 Ev","3 Ev","3 1/6 Ev","3 1/3 Ev","3 1/2 Ev", "3 2/3 Ev","3 5/6 Ev","4 Ev"}; 1500 conf.fast_ev_step+=change; 1501 if (conf.fast_ev_step<0) 1502 conf.fast_ev_step=(sizeof(modes)/sizeof(modes[0]))-1; 1503 else if (conf.fast_ev_step>=(sizeof(modes)/sizeof(modes[0]))) 1504 conf.fast_ev_step=0; 1505 return modes[conf.fast_ev_step]; 1303 return gui_change_simple_enum(&conf.fast_ev_step,change,modes,sizeof(modes)/sizeof(modes[0])); 1506 1304 } 1507 1305 #if CAM_QUALITY_OVERRIDE 1508 1306 const char* gui_fast_image_quality(int change, int arg) { 1509 1307 static const char* modes[]={"sup.fine","fine","normal","off"}; 1510 conf.fast_image_quality+=change; 1511 if (conf.fast_image_quality<0) 1512 conf.fast_image_quality=(sizeof(modes)/sizeof(modes[0]))-1; 1513 else if (conf.fast_image_quality>=(sizeof(modes)/sizeof(modes[0]))) 1514 conf.fast_image_quality=0; 1515 return modes[conf.fast_image_quality]; 1308 return gui_change_simple_enum(&conf.fast_image_quality,change,modes,sizeof(modes)/sizeof(modes[0])); 1516 1309 } 1517 1310 #endif … … 1523 1316 static const char* modes[]={ "Default", "Quality"}; 1524 1317 #endif 1525 conf.video_mode+=change; 1526 if (conf.video_mode<0) 1527 conf.video_mode=(sizeof(modes)/sizeof(modes[0]))-1; 1528 else if (conf.video_mode>=(sizeof(modes)/sizeof(modes[0]))) 1529 conf.video_mode=0; 1530 1531 return modes[conf.video_mode]; 1318 return gui_change_simple_enum(&conf.video_mode,change,modes,sizeof(modes)/sizeof(modes[0])); 1532 1319 } 1533 1320 1534 1321 //------------------------------------------------------------------- 1535 1322 const char* gui_video_bitrate_enum(int change, int arg) { 1536 conf.video_bitrate+=change; 1537 if (conf.video_bitrate<0) 1538 conf.video_bitrate=VIDEO_BITRATE_STEPS-1; 1539 else if (conf.video_bitrate>=VIDEO_BITRATE_STEPS) 1540 conf.video_bitrate=0; 1323 gui_enum_value_change(&conf.video_bitrate,change,VIDEO_BITRATE_STEPS); 1541 1324 1542 1325 shooting_video_bitrate_change(conf.video_bitrate); … … 1549 1332 const char* gui_tv_bracket_values_enum(int change, int arg) { 1550 1333 static const char* modes[]={ "Off", "1/3 Ev","2/3 Ev", "1 Ev", "1 1/3Ev", "1 2/3Ev", "2 Ev", "2 1/3Ev", "2 2/3Ev", "3 Ev", "3 1/3Ev", "3 2/3Ev", "4 Ev"}; 1551 1552 conf.tv_bracket_value+=change; 1553 if (conf.tv_bracket_value<0) 1554 conf.tv_bracket_value=sizeof(modes)/sizeof(modes[0])-1; 1555 else if (conf.tv_bracket_value>=(sizeof(modes)/sizeof(modes[0]))) 1556 conf.tv_bracket_value=0; 1557 1558 return modes[conf.tv_bracket_value]; 1334 return gui_change_simple_enum(&conf.tv_bracket_value,change,modes,sizeof(modes)/sizeof(modes[0])); 1559 1335 } 1560 1336 1561 1337 const char* gui_av_bracket_values_enum(int change, int arg) { 1562 1338 static const char* modes[]={ "Off", "1/3 Ev","2/3 Ev", "1 Ev", "1 1/3Ev", "1 2/3Ev", "2 Ev", "2 1/3Ev", "2 2/3Ev", "3 Ev", "3 1/3Ev", "3 2/3Ev", "4 Ev"}; 1563 1564 conf.av_bracket_value+=change; 1565 if (conf.av_bracket_value<0) 1566 conf.av_bracket_value=sizeof(modes)/sizeof(modes[0])-1; 1567 else if (conf.av_bracket_value>=(sizeof(modes)/sizeof(modes[0]))) 1568 conf.av_bracket_value=0; 1569 1570 return modes[conf.av_bracket_value]; 1339 return gui_change_simple_enum(&conf.av_bracket_value,change,modes,sizeof(modes)/sizeof(modes[0])); 1571 1340 } 1572 1341 1573 1342 const char* gui_subj_dist_bracket_koef_enum(int change, int arg) { 1574 1343 static const char* modes[]={"Off", "1", "10","100","1000"}; 1575 1576 conf.subj_dist_bracket_koef+=change; 1577 if (conf.subj_dist_bracket_koef<0) 1578 conf.subj_dist_bracket_koef=sizeof(modes)/sizeof(modes[0])-1; 1579 else if (conf.subj_dist_bracket_koef>=(sizeof(modes)/sizeof(modes[0]))) 1580 conf.subj_dist_bracket_koef=0; 1581 1582 return modes[conf.subj_dist_bracket_koef]; 1344 return gui_change_simple_enum(&conf.subj_dist_bracket_koef,change,modes,sizeof(modes)/sizeof(modes[0])); 1583 1345 } 1584 1346 1585 1347 const char* gui_iso_bracket_koef_enum(int change, int arg) { 1586 1348 static const char* modes[]={ "Off","1", "10","100"}; 1587 1588 conf.iso_bracket_koef+=change; 1589 if (conf.iso_bracket_koef<0) 1590 conf.iso_bracket_koef=sizeof(modes)/sizeof(modes[0])-1; 1591 else if (conf.iso_bracket_koef>=(sizeof(modes)/sizeof(modes[0]))) 1592 conf.iso_bracket_koef=0; 1593 1594 return modes[conf.iso_bracket_koef]; 1349 return gui_change_simple_enum(&conf.iso_bracket_koef,change,modes,sizeof(modes)/sizeof(modes[0])); 1595 1350 } 1596 1351 1597 1352 const char* gui_bracket_type_enum(int change, int arg) { 1598 1353 static const char* modes[]={ "+/-", "-","+"}; 1599 1600 conf.bracket_type+=change; 1601 if (conf.bracket_type<0) 1602 conf.bracket_type=0; 1603 else if (conf.bracket_type>=(sizeof(modes)/sizeof(modes[0]))) 1604 conf.bracket_type=sizeof(modes)/sizeof(modes[0])-1; 1605 1606 return modes[conf.bracket_type]; 1354 return gui_change_simple_enum(&conf.bracket_type,change,modes,sizeof(modes)/sizeof(modes[0])); 1607 1355 } 1608 1356 … … 1680 1428 const char* gui_iso_override_koef_enum(int change, int arg) { 1681 1429 static const char* modes[]={ "Off","1", "10","100"}; 1682 1683 conf.iso_override_koef+=change; 1684 if (conf.iso_override_koef<0) 1685 conf.iso_override_koef=0; 1686 else if (conf.iso_override_koef>=(sizeof(modes)/sizeof(modes[0]))) 1687 conf.iso_override_koef=sizeof(modes)/sizeof(modes[0])-1; 1688 1689 return modes[conf.iso_override_koef]; 1430 return gui_change_simple_enum(&conf.iso_override_koef,change,modes,sizeof(modes)/sizeof(modes[0])); 1690 1431 } 1691 1432 … … 1705 1446 const char* gui_subj_dist_override_koef_enum(int change, int arg) { 1706 1447 static const char* modes[]={ "Off","1", "10","100","1000"}; 1707 1708 conf.subj_dist_override_koef+=change; 1709 if (conf.subj_dist_override_koef<0) conf.subj_dist_override_koef=0; 1710 else if (conf.subj_dist_override_koef>=(sizeof(modes)/sizeof(modes[0]))) 1711 conf.subj_dist_override_koef=sizeof(modes)/sizeof(modes[0])-1; 1712 1713 return modes[conf.subj_dist_override_koef]; 1448 return gui_change_simple_enum(&conf.subj_dist_override_koef,change,modes,sizeof(modes)/sizeof(modes[0])); 1714 1449 } 1715 1450 … … 1803 1538 1804 1539 if (conf.user_menu_enable == 3) user_menu_save(); 1805 1806 conf.user_menu_enable+=change; 1807 if (conf.user_menu_enable<0) 1808 conf.user_menu_enable=(sizeof(modes)/sizeof(modes[0]))-1; 1809 else if (conf.user_menu_enable>=(sizeof(modes)/sizeof(modes[0]))) 1810 conf.user_menu_enable=0; 1811 1812 return modes[conf.user_menu_enable]; 1540 return gui_change_simple_enum(&conf.user_menu_enable,change,modes,sizeof(modes)/sizeof(modes[0])); 1813 1541 } 1814 1542 … … 1836 1564 const char* gui_bad_pixel_enum(int change, int arg) { 1837 1565 int modes[]={LANG_MENU_BAD_PIXEL_OFF, LANG_MENU_BAD_PIXEL_INTERPOLATION, LANG_MENU_BAD_PIXEL_RAW_CONVERTER}; 1838 conf.bad_pixel_removal+=change; 1839 if (conf.bad_pixel_removal<0) 1840 conf.bad_pixel_removal=(sizeof(modes)/sizeof(modes[0]))-1; 1841 else if (conf.bad_pixel_removal>=(sizeof(modes)/sizeof(modes[0]))) 1842 conf.bad_pixel_removal=0; 1843 1844 return lang_str(modes[conf.bad_pixel_removal]); 1566 return lang_str(gui_change_simple_enum(&conf.bad_pixel_removal,change,modes,sizeof(modes)/sizeof(modes[0]))); 1845 1567 } 1846 1568 … … 1938 1660 static const char * gui_debug_shortcut_enum(int change, int arg) { 1939 1661 static const char* modes[]={ "None", "DmpRAM", "Page", "CmpProps"}; 1940 1941 conf.debug_shortcut_action += change; 1942 if (conf.debug_shortcut_action < 0) 1943 conf.debug_shortcut_action = sizeof(modes)/sizeof(modes[0])-1; 1944 else if (conf.debug_shortcut_action >= (sizeof(modes)/sizeof(modes[0]))) 1945 conf.debug_shortcut_action = 0; 1946 1947 return modes[conf.debug_shortcut_action]; 1662 return gui_change_simple_enum(&conf.debug_shortcut_action,change,modes,sizeof(modes)/sizeof(modes[0])); 1948 1663 } 1949 1664 1950 1665 static const char * gui_debug_display_enum(int change, int arg) { 1951 1666 static const char* modes[]={ "None", "Props", "Params", "Tasks"}; 1952 1953 conf.debug_display += change; 1954 if (conf.debug_display < 0) 1955 conf.debug_display=sizeof(modes)/sizeof(modes[0])-1; 1956 else if (conf.debug_display >= (sizeof(modes)/sizeof(modes[0]))) 1957 conf.debug_display = 0; 1958 1959 return modes[conf.debug_display]; 1667 return gui_change_simple_enum(&conf.debug_display,change,modes,sizeof(modes)/sizeof(modes[0])); 1960 1668 } 1961 1669 … … 3364 3072 { 3365 3073 static const char* modes[]={ "Off", "Right", "Down", "Left", "Up", "Free"}; 3366 3367 conf.edge_overlay_pano+=change; 3368 if (conf.edge_overlay_pano<0) 3369 conf.edge_overlay_pano=(sizeof(modes)/sizeof(modes[0]))-1; 3370 else if (conf.edge_overlay_pano>=(sizeof(modes)/sizeof(modes[0]))) 3371 conf.edge_overlay_pano=0; 3372 return modes[conf.edge_overlay_pano]; 3074 return gui_change_simple_enum(&conf.edge_overlay_pano,change,modes,sizeof(modes)/sizeof(modes[0])); 3373 3075 } 3374 3076 #endif
Note: See TracChangeset
for help on using the changeset viewer.