source: trunk/include/conf.h @ 1797

Revision 1797, 12.4 KB checked in by philmoz, 2 years ago (diff)

Add option to disable the 'zoom assist' button on the SX30 and SX40.

  • Property svn:eol-style set to native
Line 
1#ifndef CONF_H
2#define CONF_H
3
4#include "gui.h"
5#include "script.h"
6
7#define USER_MENU_ITEMS     14
8#define CONF_STR_LEN        100
9
10#define CONF_EMPTY          0
11// regular char-int-short value
12#define CONF_VALUE          1
13#define CONF_DEF_VALUE      1
14// pointer to value
15#define CONF_VALUE_PTR      2
16// pointer to array of int
17#define CONF_INT_PTR        3
18// pointer to the string
19#define CONF_CHAR_PTR       4
20// OSD_pos
21#define CONF_OSD_POS        5
22
23// Name of default symbol file (for reset)
24#define DEFAULT_SYMBOL_FILE "A/CHDK/SYMBOLS/icon_10.rbf"
25
26typedef struct {
27    unsigned short  x, y;
28} OSD_pos;
29
30typedef struct {
31    int isNumb, isStr, isPInt, isPos;
32    int numb;
33    char* str;
34    int* pInt;
35    OSD_pos pos;
36} tConfigVal;
37
38// Please try do not change existed structure, because this will broke modules compatibility
39// If add field to the end of structure minor api version should be increased.
40// If any other change (remove something, change order, add not to the end, change meaning), major api version should be increased
41typedef struct {
42        int api_version;                        // version of this structure
43
44    int save_raw;
45    int save_raw_in_video;
46    int save_raw_in_sports;
47    int save_raw_in_burst;
48    int save_raw_in_edgeoverlay;
49    int save_raw_in_auto;
50    int save_raw_in_ev_bracketing;
51    int save_raw_in_timer;
52    int raw_exceptions_warn;
53    int raw_in_dir;
54    int raw_prefix;
55    int raw_ext;
56    int raw_save_first_only; //for series shooting
57    int raw_nr;
58    int sub_batch_prefix; // output of batch subtracts
59    int sub_batch_ext;
60    int raw_cache;
61    int dng_raw;
62    int raw_timer;
63    int raw_dng_ext;
64    int dng_usb_ext;
65
66    int show_osd;
67    int hide_osd;
68    int show_osd_in_review;
69    int script_shoot_delay;
70    int show_histo;
71    int script_vars[SCRIPT_NUM_PARAMS];
72    char script_file[CONF_STR_LEN];
73
74    int show_dof;
75    int batt_volts_max;
76    int batt_volts_min;
77    int batt_step_25;
78    int batt_perc_show;
79    int batt_volts_show;
80    int batt_icon_show;
81    int space_bar_show;
82    int space_bar_size;
83    int space_bar_width;
84    int space_icon_show;
85    int show_clock;
86    int show_temp;
87    int temperature_unit;
88    int clock_format;
89    int clock_indicator;
90    int clock_halfpress;
91    int space_perc_show;
92    int space_mb_show;
93    int show_partition_nr;
94    int space_perc_warn;
95    int space_mb_warn;
96    int space_warn_type;
97    int show_movie_time;
98    int show_movie_refresh;
99
100    int zoom_value;
101
102    int show_state;
103    int show_remaining_raw;
104    int remaining_raw_treshold;
105    int show_raw_state;
106    int show_values;
107    int show_values_in_video;
108    int show_overexp;
109
110    int histo_mode;
111    int histo_auto_ajust;
112    int histo_ignore_boundary;
113    int histo_layout;
114    int histo_show_ev_grid;
115
116    int zebra_draw;
117    //int zebra_mode;
118    //int zebra_restore_screen;
119    //int zebra_restore_osd;
120    //int zebra_over;
121    //int zebra_under;
122    //int zebra_draw_osd;
123    //int zebra_multichannel;
124
125    OSD_pos histo_pos;
126    OSD_pos dof_pos;
127    OSD_pos batt_icon_pos;
128    OSD_pos space_icon_pos;
129    OSD_pos space_hor_pos;
130    OSD_pos space_ver_pos;
131    OSD_pos batt_txt_pos;
132    OSD_pos space_txt_pos;
133    OSD_pos mode_state_pos;
134    OSD_pos mode_raw_pos;
135    OSD_pos values_pos;
136    OSD_pos clock_pos;
137    OSD_pos mode_video_pos;
138    OSD_pos mode_ev_pos;
139    OSD_pos temp_pos;
140    OSD_pos ev_video_pos;
141    OSD_pos usb_info_pos;
142
143    color histo_color;
144    color histo_color2; // markers/border
145    color osd_color;
146    color osd_color_warn;
147//    color batt_icon_color;
148    color space_color;
149    color menu_color;
150    color menu_title_color;
151    color menu_cursor_color;
152    color menu_symbol_color;
153    int menu_center;
154    int menu_select_first_entry;
155    int menu_symbol_enable;
156    //color reader_color;
157    //color zebra_color;    // under/over
158    //color grid_color;
159    color osd_color_override;
160
161    int font_cp;
162    char menu_rbf_file[CONF_STR_LEN];
163    char menu_symbol_rbf_file[CONF_STR_LEN];
164
165    char lang_file[CONF_STR_LEN];
166
167    //char reader_file[CONF_STR_LEN];
168    //int  reader_pos;
169    //int  reader_autoscroll;
170    //int  reader_autoscroll_delay;
171    //char reader_rbf_file[100];
172    //int  reader_codepage;
173    //int  reader_wrap_by_words;
174
175    //int sokoban_level;
176
177    int flashlight;
178    int fast_ev;
179    int fast_ev_step;
180    int fast_image_quality;
181    int fast_movie_control;
182    int fast_movie_quality_control;
183    int splash_show;
184    int start_sound;
185    int platformid;
186
187    int use_zoom_mf;
188    long alt_mode_button; //for S-series
189    int alt_prevent_shutdown;
190
191    int show_grid_lines;
192    //char grid_lines_file[CONF_STR_LEN];
193    //int grid_force_color;
194
195    int video_mode;
196    int video_quality;
197    int video_bitrate;
198
199    int tv_bracket_value;
200    int av_bracket_value;
201    int iso_bracket_value;
202    int iso_bracket_koef;
203    int subj_dist_bracket_value;
204    int subj_dist_bracket_koef;
205    int bracket_type;
206    int bracketing_add_raw_suffix;
207    int clear_bracket;
208    int clear_video;
209    int override_disable;
210    int override_disable_all;
211
212    int tv_override_value;
213    int tv_override_koef;
214    int tv_enum_type;
215    int av_override_value;
216
217    int nd_filter_state;
218
219    int iso_override_value;
220    int iso_override_koef;
221//    int zoom_override_value;
222//    int zoom_override;
223    int subj_dist_override_value;
224    int subj_dist_override_koef;
225    int clear_override;
226//    int clear_zoom_override;
227
228    int autoiso_enable;
229//  int autoiso_shutter;
230    int autoiso_shutter_enum;
231    int autoiso_user_factor;
232    int autoiso_is_factor;
233    int autoiso_max_iso_hi;
234    int autoiso_max_iso_auto;
235    int autoiso_min_iso;
236    int autoiso2_shutter_enum;
237    int autoiso2_max_iso_auto;
238    //AutoISO2 precalced values
239    float autoiso2_coef;        // C2=( iso2_max_auto_real - iso_max_auto_real) / ( tv_num[autoiso_shutter] - tv_numerator[autoiso2_shutter])
240    int autoiso_max_iso_hi_real;    // converted from GUI (possible marketing) to real iso value
241    int autoiso_max_iso_auto_real;
242    int autoiso_min_iso_real;
243    int autoiso2_max_iso_auto_real;
244    int autoiso_min_shutter_numerator;  // converted from enum to numerator
245    int autoiso2_min_shutter_numerator;
246    int autoiso2_over;
247   
248    int overexp_threshold;
249    int overexp_ev_enum;    // 0-off, 1=-1/3, ..
250
251    int dof_subj_dist_as_near_limit;
252    int dof_use_exif_subj_dist;
253    int dof_subj_dist_in_misc;
254    int dof_near_limit_in_misc;
255    int dof_far_limit_in_misc;
256    int dof_hyperfocal_in_misc;
257    int dof_depth_in_misc;
258//    int dof_dist_from_lens;
259
260    int values_show_in_review;
261    int values_show_zoom;
262    int values_show_real_aperture;
263    int values_show_real_iso;
264    int values_show_market_iso;
265    int values_show_iso_only_in_autoiso_mode;
266    int values_show_ev_seted;
267    int values_show_ev_measured;
268    int values_show_bv_measured;
269    int values_show_bv_seted;
270    int values_show_overexposure;
271    int values_show_canon_overexposure;
272    int values_show_luminance;
273
274    int debug_shortcut_action;   // 0=none, 1=dump, 2=page display
275    int debug_display;           // 0=none, 1=props, 2=flash param, 3=tasks
276    int debug_propcase_page;     // save propcase page
277    int debug_lua_restart_on_error; // 0=no, 1=yes
278    int debug_misc_vals_show;    // 0=no, 1=yes
279
280    int script_startup;          // remote autostart
281    int remote_enable;           // remote enable
282    int user_menu_enable;
283    int user_menu_vars[USER_MENU_ITEMS];
284    int user_menu_as_root;
285    int zoom_scale;
286    int unlock_optical_zoom_for_video;
287    int mute_on_zoom;
288    int bad_pixel_removal;
289    int video_af_key;
290
291    char curve_file[CONF_STR_LEN];
292    int curve_enable;
293
294    int edge_overlay_enable;
295    //int edge_overlay_filter;
296    int edge_overlay_thresh;
297    //int edge_overlay_zoom;    // shall zoom be set when *edg file is loaded?
298    int edge_overlay_pano;    // whether a full press changes back to live mode
299    //int edge_overlay_pano_overlap;    // overlap in % in pano mode
300    //int edge_overlay_show;    // whether to show overlay even when no button is pressed
301    //int edge_overlay_play;    // whether edge overlay is switched on also for play mode
302    //color edge_overlay_color;
303
304    int synch_enable;
305    int ricoh_ca1_mode;
306    int synch_delay_enable;
307    int synch_delay_value;
308    int synch_delay_coarse_value;               // obsolete - no longer used
309    int remote_zoom_enable;
310    int zoom_timeout;
311
312    int script_param_set;
313    int script_param_save;
314
315    long mem_view_addr_init;
316    int flash_sync_curtain;
317    int flash_video_override;
318    int flash_manual_override;
319    int flash_video_override_power;
320
321    // Overrides to disable touchscreen U/I components (IXUS 310)
322    int touchscreen_disable_video_controls;
323    int touchscreen_disable_shortcut_controls;
324
325        // Enable USB icon
326    int usb_info_enable;
327
328        // gen 2 USB remote
329        int remote_switch_type;
330        int remote_control_mode;
331
332    int ext_video_time;
333   
334    int remote_enable_scripts;  // usb remote activates scripts in <ALT> mode
335   
336#if defined(CAM_ZOOM_ASSIST_BUTTON_CONTROL)
337    int zoom_assist_button_disable;    // used to disable the zoom assist button on SX30 & SX40 for people who keep accidentaly pressing it
338#endif
339
340#ifdef CAM_HAS_GPS
341    int gps_record;
342    int gps_navi_show;
343    int gps_navi_hide;
344    int gps_kompass_show;
345    int gps_kompass_hide;
346    int gps_coordinates_show;
347    int gps_height_show;
348    int gps_waypoint_save;
349    int gps_track_time;
350    int gps_wait_for_signal;
351    int gps_kompass_time;
352    int gps_navi_time;
353    int gps_wait_for_signal_time;
354    int gps_kompass_smooth;
355    int gps_batt;
356    int gps_countdown;
357    int gps_2D_3D_fix;
358    int gps_countdown_blink;
359    int gps_rec_play_set;
360    int gps_play_dark_set;
361    int gps_rec_play_time;
362    int gps_play_dark_time;
363    int gps_rec_play_set_1;
364    int gps_play_dark_set_1;
365    int gps_rec_play_time_1;
366    int gps_play_dark_time_1;
367    int gps_show_symbol;
368
369    int gps_batt_warn;
370    int gps_track_symbol;
371    int gps_test_timezone;
372    int gps_beep_warn;
373    int gps_on_off;
374#endif
375} Conf;
376
377extern Conf conf;
378
379#define ALT_PREVENT_SHUTDOWN_NO         0
380#define ALT_PREVENT_SHUTDOWN_ALT        1
381#define ALT_PREVENT_SHUTDOWN_ALT_SCRIPT 2
382#define ALT_PREVENT_SHUTDOWN_ALWAYS     3
383
384#define SHOOTING_PROGRESS_NONE          0
385#define SHOOTING_PROGRESS_STARTED       1
386#define SHOOTING_PROGRESS_PROCESSING    2
387#define SHOOTING_PROGRESS_DONE          3
388
389
390// video quality defaults. Ideally, these should match the camera default settings
391#define VIDEO_DEFAULT_QUALITY   84  // ? where does 84 come from
392#define VIDEO_MAX_QUALITY       99
393#define VIDEO_DEFAULT_BITRATE   3   // should be 1 for all cams
394
395extern void user_menu_restore();
396
397extern int state_kbd_script_run;
398extern int state_shooting_progress;
399extern int state_save_raw_nth_only;
400
401extern void script_autostart();     // remote autostart
402extern void conf_save();
403extern void conf_restore();
404extern void conf_load_defaults();
405extern int shutter_int;
406extern void conf_change_dng(void);
407extern void conf_update_prevent_shutdown(void);
408extern int conf_getValue(unsigned short id, tConfigVal* configVal);
409extern int conf_setValue(unsigned short id, tConfigVal configVal);
410
411// reyalp: putting these in conf, since the conf values are lookups for them
412// prefixes and extentions available for raw images (index with conf.raw_prefix etc)
413#define NUM_IMG_PREFIXES 3  // IMG_ CRW_ SND_ (could add ETC_ SDR_ AUT_ MVI_ MRK_)
414#define NUM_IMG_EXTS 5      // .JPG .CRW .CR2 .THM .WAV (could add .AVI .MRK)
415extern const char* img_prefixes[NUM_IMG_PREFIXES];
416extern const char* img_exts[NUM_IMG_EXTS];
417
418extern int is_raw_enabled();
419
420//-------------------------------------------------------------------
421
422typedef struct {
423    unsigned short      id;
424    unsigned char       size;
425    char                type;
426    void                *var;
427    union {
428        void            *ptr;
429        int             i;
430        color           cl;
431        OSD_pos         pos;
432    };
433    // Since only a few of the ConfInfo entries have a 'func' it saves space to not store the function addresses in the ConfInfo struct
434    // handled in conf_info_func code
435    //void                (*func)();
436} ConfInfo;
437
438#define CONF_INFO(id, param, type, def, func) { id, sizeof( param ), type, &param, {def}/*, func*/ }
439#define CONF_INFO2(id, param, type, px, py)   { id, sizeof( param ), type, &param, {pos:{px,py}} }
440
441extern void config_save(const ConfInfo *conf_info, char *filename, int conf_num);
442extern void config_restore(const ConfInfo *confinfo, char *filename, int conf_num, void (*info_func)(unsigned short id));
443
444//-------------------------------------------------------------------
445
446#endif
Note: See TracBrowser for help on using the repository browser.