1 #ifndef CONF_H
2 #define CONF_H
3
4
5
6
7
8
9
10
11 #include "stdlib.h"
12 #include "color.h"
13 #include "script.h"
14
15
16
17 #define CONF_STR_LEN 100
18
19 #define CONF_EMPTY 0
20
21 #define CONF_VALUE 1
22 #define CONF_DEF_VALUE 1
23
24 #define CONF_FUNC_PTR 2
25
26 #define CONF_INT_PTR 3
27
28 #define CONF_CHAR_PTR 4
29
30 #define CONF_OSD_POS 5
31
32 #define CONF_STRUCT_PTR 6
33
34 typedef struct {
35 unsigned short x, y;
36 } OSD_pos;
37
38 typedef struct {
39 unsigned short x, y;
40 } OSD_scale;
41
42 typedef struct {
43 int isNumb, isStr, isPInt, isPos;
44 int numb;
45 char* str;
46 int* pInt;
47 OSD_pos pos;
48 } tConfigVal;
49
50
51 typedef struct {
52 int num_items;
53 int item_size;
54 int (*saved_size)();
55 char* (*save)(char *dst);
56 int (*load)(char *src);
57 } tVarArrayConfig;
58
59
60 typedef struct {
61 int var;
62 char *script_file;
63 char *script_title;
64 } tUserMenuItem;
65
66 typedef struct {
67 tVarArrayConfig cfg;
68 tUserMenuItem *items;
69 } tUserMenuConfig;
70
71
72
73
74
75
76
77
78
79 #define CONF_VERSION {3,6}
80
81 typedef struct
82 {
83 int save_raw;
84 int save_raw_in_video;
85 int save_raw_in_sports;
86 int save_raw_in_burst;
87 int save_raw_in_edgeoverlay;
88 int save_raw_in_auto;
89 int save_raw_in_ev_bracketing;
90 int save_raw_in_timer;
91 int raw_exceptions_warn;
92 int raw_in_dir;
93 int raw_prefix;
94 int raw_ext;
95 int raw_save_first_only;
96 int raw_nr;
97 int sub_batch_prefix;
98 int sub_batch_ext;
99 int raw_cache;
100 int dng_raw;
101 int dng_version;
102 int raw_timer;
103 int raw_dng_ext;
104 int dng_usb_ext;
105 int dng_crop_size;
106
107 int show_osd;
108 int hide_osd;
109 int show_osd_in_review;
110 int rotate_osd;
111 int script_shoot_delay;
112 int show_histo;
113 int script_allow_lua_native_calls;
114 char script_file[CONF_STR_LEN];
115
116 int show_dof;
117 int batt_volts_max;
118 int batt_volts_min;
119 int batt_perc_show;
120 int batt_volts_show;
121 int batt_icon_show;
122 int space_bar_show;
123 int space_bar_size;
124 int space_bar_width;
125 int space_icon_show;
126 int show_clock;
127 int show_temp;
128 int temperature_unit;
129 int clock_format;
130 int clock_indicator;
131 int clock_halfpress;
132 int space_perc_show;
133 int space_mb_show;
134 int show_partition_nr;
135 int space_perc_warn;
136 int space_mb_warn;
137 int space_warn_type;
138 int show_movie_time;
139 int show_movie_refresh;
140
141 int zoom_value;
142
143 int show_state;
144 int show_remaining_raw;
145 int remaining_raw_treshold;
146 int show_raw_state;
147 int show_values;
148 int show_values_in_video;
149 int show_overexp;
150 int show_hiddenfiles;
151
152 int histo_mode;
153 int histo_auto_ajust;
154 int histo_ignore_boundary;
155 int histo_layout;
156 int histo_show_ev_grid;
157
158 int zebra_draw;
159 int zebra_mode;
160 int zebra_restore_screen;
161 int zebra_restore_osd;
162 int zebra_over;
163 int zebra_under;
164 int zebra_draw_osd;
165 int zebra_multichannel;
166
167 OSD_pos histo_pos;
168 OSD_pos dof_pos;
169 OSD_pos batt_icon_pos;
170 OSD_pos space_icon_pos;
171 OSD_pos space_hor_pos;
172 OSD_pos space_ver_pos;
173 OSD_pos batt_txt_pos;
174 OSD_pos space_txt_pos;
175 OSD_pos mode_state_pos;
176 OSD_pos mode_raw_pos;
177 OSD_pos values_pos;
178 OSD_pos clock_pos;
179 OSD_pos mode_video_pos;
180 OSD_pos mode_ev_pos;
181 OSD_pos temp_pos;
182 OSD_pos ev_video_pos;
183 OSD_pos usb_info_pos;
184
185 OSD_scale histo_scale;
186 OSD_scale dof_scale;
187 OSD_scale batt_icon_scale;
188 OSD_scale space_icon_scale;
189 OSD_scale space_hor_scale;
190 OSD_scale space_ver_scale;
191 OSD_scale batt_txt_scale;
192 OSD_scale space_txt_scale;
193 OSD_scale mode_state_scale;
194 OSD_scale mode_raw_scale;
195 OSD_scale values_scale;
196 OSD_scale clock_scale;
197 OSD_scale mode_video_scale;
198 OSD_scale mode_ev_scale;
199 OSD_scale temp_scale;
200 OSD_scale ev_video_scale;
201 OSD_scale usb_info_scale;
202
203
204 confColor histo_color;
205 confColor histo_color2;
206 confColor osd_color;
207 confColor osd_color_warn;
208 confColor osd_color_override;
209 confColor space_color;
210 confColor menu_color;
211 confColor menu_title_color;
212 confColor menu_cursor_color;
213 confColor menu_symbol_color;
214 confColor reader_color;
215 confColor zebra_color;
216 confColor grid_color;
217 confColor edge_overlay_color;
218
219 int menu_center;
220 int menu_select_first_entry;
221 int menu_symbol_enable;
222
223 int font_cp;
224 char menu_rbf_file[CONF_STR_LEN];
225 char menu_symbol_rbf_file[CONF_STR_LEN];
226
227 char lang_file[CONF_STR_LEN];
228
229 char reader_file[CONF_STR_LEN];
230 int reader_pos;
231 int reader_autoscroll;
232 int reader_autoscroll_delay;
233 char reader_rbf_file[100];
234 int reader_codepage;
235 int reader_wrap_by_words;
236
237 int flashlight;
238 int fast_ev;
239 int fast_ev_step;
240 int fast_image_quality;
241 int fast_movie_control;
242 int fast_movie_quality_control;
243 int splash_show;
244 int start_sound;
245 int platformid;
246
247 int use_zoom_mf;
248 long alt_mode_button;
249 int alt_prevent_shutdown;
250
251 int show_grid_lines;
252 char grid_lines_file[CONF_STR_LEN];
253 int grid_force_color;
254 char grid_title[36];
255
256 int video_mode;
257 int video_quality;
258 int video_bitrate;
259
260 int tv_bracket_value;
261 int av_bracket_value;
262 int iso_bracket_value;
263 int iso_bracket_koef;
264 int subj_dist_bracket_value;
265 int subj_dist_bracket_koef;
266 int bracket_type;
267 int bracketing_add_raw_suffix;
268 int clear_bracket;
269 int clear_video;
270 int override_disable;
271
272
273
274
275
276 int override_disable_all;
277
278
279 int tv_override_enabled;
280 int tv_override_value;
281 int tv_override_long_exp;
282 int tv_override_short_exp;
283 int tv_enum_type;
284 int av_override_enabled;
285 int av_override_value;
286
287 int nd_filter_state;
288
289 int iso_override_value;
290 int iso_override_koef;
291 int subj_dist_override_value;
292 int subj_dist_override_koef;
293 int clear_override;
294
295 int autoiso_enable;
296 int autoiso_shutter_enum;
297 int autoiso_user_factor;
298 int autoiso_is_factor;
299 int autoiso_max_iso_hi;
300 int autoiso_max_iso_auto;
301 int autoiso_min_iso;
302 int autoiso2_shutter_enum;
303 int autoiso2_max_iso_auto;
304
305 float autoiso2_coef;
306 int autoiso_max_iso_hi_real;
307 int autoiso_max_iso_auto_real;
308 int autoiso_min_iso_real;
309 int autoiso2_max_iso_auto_real;
310 int autoiso2_over;
311
312 int overexp_threshold;
313 int overexp_ev_enum;
314
315 int dof_subj_dist_as_near_limit;
316 int dof_use_exif_subj_dist;
317 int dof_subj_dist_in_misc;
318 int dof_near_limit_in_misc;
319 int dof_far_limit_in_misc;
320 int dof_hyperfocal_in_misc;
321 int dof_depth_in_misc;
322
323 int values_show_in_review;
324 int values_show_zoom;
325 int values_show_real_aperture;
326 int values_show_real_iso;
327 int values_show_market_iso;
328 int values_show_iso_only_in_autoiso_mode;
329 int values_show_ev_seted;
330 int values_show_ev_measured;
331 int values_show_bv_measured;
332 int values_show_bv_seted;
333 int values_show_overexposure;
334 int values_show_canon_overexposure;
335 int values_show_luminance;
336
337 int debug_shortcut_action;
338 int debug_display;
339 int debug_propcase_page;
340 int debug_lua_restart_on_error;
341 int debug_misc_vals_show;
342
343 int script_startup;
344 int remote_enable;
345 int user_menu_enable;
346 int user_menu_as_root;
347 tUserMenuConfig user_menu_vars;
348 int zoom_scale;
349 int unlock_optical_zoom_for_video;
350 int mute_on_zoom;
351 int bad_pixel_removal;
352 int video_af_key;
353
354 char curve_file[CONF_STR_LEN];
355 int curve_enable;
356
357 int edge_overlay_enable;
358 int edge_overlay_filter;
359 int edge_overlay_thresh;
360 int edge_overlay_zoom;
361 int edge_overlay_pano;
362 int edge_overlay_pano_overlap;
363 int edge_overlay_show;
364 int edge_overlay_play;
365
366 int synch_enable;
367 int ricoh_ca1_mode;
368 int synch_delay_enable;
369 int synch_delay_value;
370
371 int script_param_set;
372 int script_param_save;
373
374 long mem_view_addr_init;
375 int flash_sync_curtain;
376 int flash_video_override;
377 int flash_manual_override;
378 int flash_video_override_power;
379 int flash_enable_exp_comp;
380 int flash_exp_comp;
381
382
383 int touchscreen_disable_video_controls;
384 int touchscreen_disable_shortcut_controls;
385
386
387 int usb_info_enable;
388
389
390 int remote_switch_type;
391 int remote_control_mode;
392
393 int ext_video_time;
394
395 int remote_enable_scripts;
396
397 int zoom_assist_button_disable;
398
399 int gps_record;
400 int gps_navi_show;
401 int gps_navi_hide;
402 int gps_compass_show;
403 int gps_compass_hide;
404 int gps_coordinates_show;
405 int gps_height_show;
406 int gps_waypoint_save;
407 int gps_track_time;
408 int gps_wait_for_signal;
409 int gps_compass_time;
410 int gps_navi_time;
411 int gps_wait_for_signal_time;
412 int gps_compass_smooth;
413 int gps_batt;
414 int gps_countdown;
415 int gps_2D_3D_fix;
416 int gps_countdown_blink;
417 int gps_rec_play_set;
418 int gps_play_dark_set;
419 int gps_rec_play_time;
420 int gps_play_dark_time;
421 int gps_rec_play_set_1;
422 int gps_play_dark_set_1;
423 int gps_rec_play_time_1;
424 int gps_play_dark_time_1;
425 int gps_show_symbol;
426
427 int gps_batt_warn;
428 int gps_track_symbol;
429 int gps_test_timezone;
430 int gps_beep_warn;
431 int gps_on_off;
432
433 int tbox_char_map;
434 int show_alt_helper;
435 int show_alt_helper_delay;
436
437 long extra_button;
438
439 int module_logging;
440
441 int enable_shortcuts;
442
443 int console_show;
444 int console_timeout;
445
446 int memdmp_start;
447 int memdmp_size;
448
449 int remote_input_channel;
450
451 int hotshoe_override;
452
453 int allow_unsafe_io;
454
455 int disable_lfn_parser_ui;
456
457
458 int enable_raw_shortcut;
459
460 int osd_platformid;
461
462 int save_raw_in_canon_raw;
463
464 int clean_overlay;
465
466 int unlock_av_out_in_rec;
467
468 int check_firmware_crc;
469
470 } Conf;
471
472 extern Conf conf;
473
474
475
476
477
478
479 #define overrides_are_enabled ( conf.override_disable != 1 )
480
481 #define autoiso_and_bracketing_overrides_are_enabled ( !(conf.override_disable == 1 && conf.override_disable_all) )
482
483
484 #define TV_OVERRIDE_EV_STEP 0
485 #define TV_OVERRIDE_SHORT_EXP 1
486 #define TV_OVERRIDE_LONG_EXP 2
487 #define is_tv_override_enabled ( conf.tv_override_enabled && overrides_are_enabled && \
488 ((conf.tv_enum_type == TV_OVERRIDE_EV_STEP) || \
489 (conf.tv_override_short_exp && (conf.tv_enum_type == TV_OVERRIDE_SHORT_EXP)) || \
490 (conf.tv_override_long_exp && (conf.tv_enum_type == TV_OVERRIDE_LONG_EXP)) \
491 ) \
492 )
493
494 #define is_av_override_enabled ( conf.av_override_enabled && overrides_are_enabled )
495
496 #define is_iso_override_enabled ( conf.iso_override_value && conf.iso_override_koef && overrides_are_enabled )
497
498 #define SD_OVERRIDE_OFF 0
499 #define SD_OVERRIDE_ON 1
500 #define SD_OVERRIDE_INFINITY 2
501 #define is_sd_override_enabled ( conf.subj_dist_override_value && conf.subj_dist_override_koef && overrides_are_enabled )
502
503
504 #define is_tv_bracketing_enabled ( conf.tv_bracket_value && autoiso_and_bracketing_overrides_are_enabled )
505
506 #define is_av_bracketing_enabled ( conf.av_bracket_value && autoiso_and_bracketing_overrides_are_enabled )
507
508 #define is_iso_bracketing_enabled ( conf.iso_bracket_value && conf.iso_bracket_koef && autoiso_and_bracketing_overrides_are_enabled )
509
510 #define is_sd_bracketing_enabled ( conf.subj_dist_bracket_value && conf.subj_dist_bracket_koef && autoiso_and_bracketing_overrides_are_enabled && shooting_can_focus() )
511
512 #define ALT_PREVENT_SHUTDOWN_NO 0
513 #define ALT_PREVENT_SHUTDOWN_ALT 1
514 #define ALT_PREVENT_SHUTDOWN_ALT_SCRIPT 2
515 #define ALT_PREVENT_SHUTDOWN_ALWAYS 3
516
517 #define SHOOTING_PROGRESS_NONE 0
518 #define SHOOTING_PROGRESS_STARTED 1
519 #define SHOOTING_PROGRESS_PROCESSING 2
520 #define SHOOTING_PROGRESS_DONE 3
521
522
523 #define SCRIPT_AUTOSTART_NONE 0
524 #define SCRIPT_AUTOSTART_ALWAYS 1
525 #define SCRIPT_AUTOSTART_ONCE 2
526 #define SCRIPT_AUTOSTART_ALT 3
527
528 extern void conf_save();
529 extern void conf_restore();
530 extern void conf_load_defaults();
531 extern void conf_change_dng(void);
532 extern void conf_update_prevent_shutdown(void);
533 extern void cb_autoiso_menu_change(unsigned int item);
534 extern int conf_getValue(unsigned short id, tConfigVal* configVal);
535 extern int conf_setValue(unsigned short id, tConfigVal configVal);
536 extern void conf_setAutosave(int n);
537
538
539
540 #define NUM_IMG_FOLDER_NAMES 3
541 #define NUM_IMG_PREFIXES 3
542 #define NUM_IMG_EXTS 5
543 extern const char* img_folders[NUM_IMG_FOLDER_NAMES];
544 extern const char* img_prefixes[NUM_IMG_PREFIXES];
545 extern const char* img_exts[NUM_IMG_EXTS];
546
547
548 extern int is_raw_enabled();
549
550 extern int is_raw_possible();
551
552
553
554 typedef struct {
555 unsigned short id;
556 unsigned char size;
557 char type;
558 void *var;
559 union {
560 void *ptr;
561 int i;
562 confColor cl;
563 OSD_pos pos;
564 OSD_scale scale;
565 long (*func)(void);
566 };
567 unsigned int last_saved;
568 } ConfInfo;
569
570 #define CONF_INFO(id, param, type, def) { id, sizeof( param ), type, ¶m, {def}, 0 }
571 #define CONF_INFO2(id, param, type, px, py) { id, sizeof( param ), type, ¶m, {pos:{px,py}}, 0 }
572 #define CONF_INFOP(id, param, type, px, py) { id, sizeof( param ), type, ¶m, {pos:{(px)*CAM_SCREEN_WIDTH/360,(py)*CAM_SCREEN_HEIGHT/240}}, 0 }
573 #define CONF_INFOC(id, param, type, bc, fc, bt, ft) { id, sizeof( param ), type, ¶m, {cl:{fg:{fc,ft},bg:{bc,bt}}}, 0 }
574
575 extern void config_save(ConfInfo *conf_info, const char *filename, int config_base);
576 extern void config_restore(ConfInfo *confinfo, const char *filename, void (*info_func)(unsigned short id));
577
578 extern int save_config_file(int config_base, const char *filename);
579 extern int load_config_file(int config_base, const char *filename);
580
581 extern void resetColors();
582
583
584
585 #endif