Ticket #3913: implement safe file overwrite.
[midnight-commander.git] / src / setup.h
blob7de0fe39356432b73705decbcb5c3a02a018625c
1 /** \file setup.h
2 * \brief Header: setup loading/saving
3 */
5 #ifndef MC__SETUP_H
6 #define MC__SETUP_H
8 #include <config.h>
10 #include "lib/global.h" /* GError */
12 #include "filemanager/layout.h" /* panel_view_mode_t */
13 #include "filemanager/panel.h" /* WPanel */
15 /*** typedefs(not structures) and defined constants **********************************************/
17 /* TAB length for editor and viewer */
18 #define DEFAULT_TAB_SPACING 8
20 #define MAX_MACRO_LENGTH 1024
22 /*** enums ***************************************************************************************/
24 typedef enum
26 QSEARCH_CASE_INSENSITIVE = 0, /* quick search in case insensitive mode */
27 QSEARCH_CASE_SENSITIVE = 1, /* quick search in case sensitive mode */
28 QSEARCH_PANEL_CASE = 2, /* quick search get value from panel case_sensitive */
29 QSEARCH_NUM
30 } qsearch_mode_t;
32 /*** structures declarations (and typedefs of structures)*****************************************/
34 /* panels ini options; [Panels] section */
35 typedef struct
37 gboolean show_mini_info; /* If true, show the mini-info on the panel */
38 gboolean kilobyte_si; /* If TRUE, SI units (1000 based) will be used for larger units
39 * (kilobyte, megabyte, ...). If FALSE, binary units (1024 based) will be used */
40 gboolean mix_all_files; /* If FALSE then directories are shown separately from files */
41 gboolean show_backups; /* If TRUE, show files ending in ~ */
42 gboolean show_dot_files; /* If TRUE, show files starting with a dot */
43 gboolean fast_reload; /* If TRUE then use stat() on the cwd to determine directory changes */
44 gboolean fast_reload_msg_shown; /* Have we shown the fast-reload warning in the past? */
45 gboolean mark_moves_down; /* If TRUE, marking a files moves the cursor down */
46 gboolean reverse_files_only; /* If TRUE, only selection of files is inverted */
47 gboolean auto_save_setup;
48 gboolean navigate_with_arrows; /* If TRUE: l&r arrows are used to chdir if the input line is empty */
49 gboolean scroll_pages; /* If TRUE, panel is scrolled by half the display when the cursor reaches
50 the end or the beginning of the panel */
51 gboolean scroll_center; /* If TRUE, scroll when the cursor hits the middle of the panel */
52 gboolean mouse_move_pages; /* Scroll page/item using mouse wheel */
53 gboolean filetype_mode; /* If TRUE then add per file type hilighting */
54 gboolean permission_mode; /* If TRUE, we use permission hilighting */
55 qsearch_mode_t qsearch_mode; /* Quick search mode */
56 gboolean torben_fj_mode; /* If TRUE, use some usability hacks by Torben */
57 panel_select_flags_t select_flags; /* Select/unselect file flags */
58 } panels_options_t;
60 typedef struct macro_action_t
62 long action;
63 int ch;
64 } macro_action_t;
66 typedef struct macros_t
68 int hotkey;
69 GArray *macro;
70 } macros_t;
72 struct mc_fhl_struct;
74 /*** global variables defined in .c file *********************************************************/
76 /* global paremeters */
77 extern char *global_profile_name;
78 extern gboolean confirm_delete;
79 extern gboolean confirm_directory_hotlist_delete;
80 extern gboolean confirm_execute;
81 extern gboolean confirm_exit;
82 extern gboolean confirm_overwrite;
83 extern gboolean confirm_view_dir;
84 extern gboolean safe_delete;
85 extern gboolean safe_overwrite;
86 extern gboolean clear_before_exec;
87 extern gboolean auto_menu;
88 extern gboolean drop_menus;
89 extern gboolean verbose;
90 extern gboolean copymove_persistent_attr;
91 extern gboolean classic_progressbar;
92 extern gboolean easy_patterns;
93 extern int option_tab_spacing;
94 extern gboolean auto_save_setup;
95 extern gboolean only_leading_plus_minus;
96 extern int cd_symlinks;
97 extern gboolean auto_fill_mkdir_name;
98 extern gboolean output_starts_shell;
99 extern gboolean use_file_to_check_type;
100 extern gboolean file_op_compute_totals;
101 extern gboolean editor_ask_filename_before_edit;
103 extern panels_options_t panels_options;
105 extern panel_view_mode_t startup_left_mode;
106 extern panel_view_mode_t startup_right_mode;
107 extern gboolean boot_current_is_left;
108 extern gboolean use_internal_view;
109 extern gboolean use_internal_edit;
111 #ifdef HAVE_CHARSET
112 extern int default_source_codepage;
113 extern char *autodetect_codeset;
114 extern gboolean is_autodetect_codeset_enabled;
115 #endif /* !HAVE_CHARSET */
117 #ifdef HAVE_ASPELL
118 extern char *spell_language;
119 #endif
121 /* Value of "other_dir" key in ini file */
122 extern char *saved_other_dir;
124 /* If set, then print to the given file the last directory we were at */
125 extern char *last_wd_string;
127 extern int quit;
128 /* Set to TRUE to suppress printing the last directory */
129 extern gboolean print_last_revert;
131 #ifdef USE_INTERNAL_EDIT
132 /* index to record_macro_buf[], -1 if not recording a macro */
133 extern int macro_index;
135 /* macro stuff */
136 extern struct macro_action_t record_macro_buf[MAX_MACRO_LENGTH];
138 extern GArray *macros_list;
139 #endif /* USE_INTERNAL_EDIT */
141 extern int saving_setup;
143 /*** declarations of public functions ************************************************************/
145 const char *setup_init (void);
146 void load_setup (void);
147 gboolean save_setup (gboolean save_options, gboolean save_panel_options);
148 void done_setup (void);
149 void setup_save_config_show_error (const char *filename, GError ** mcerror);
151 void load_key_defs (void);
152 #ifdef ENABLE_VFS_FTP
153 char *load_anon_passwd (void);
154 #endif /* ENABLE_VFS_FTP */
156 void load_keymap_defs (gboolean load_from_file);
157 void free_keymap_defs (void);
159 void panel_load_setup (WPanel * panel, const char *section);
160 void panel_save_setup (WPanel * panel, const char *section);
162 /*** inline functions ****************************************************************************/
164 #endif /* MC__SETUP_H */