Merge branch '4524_cleanup'
[midnight-commander.git] / lib / global.h
blobe4afd9f101211eaa40e3e8891898bd35d24be79f
1 /** \file global.h
2 * \brief Header: %global definitions for compatibility
4 * This file should be included after all system includes and before all local includes.
5 */
7 #ifndef MC_GLOBAL_H
8 #define MC_GLOBAL_H
10 #include <glib.h>
11 #include "glibcompat.h"
13 #include "unixcompat.h"
15 #include "fs.h"
16 #include "shell.h"
17 #include "mcconfig.h"
19 /*** typedefs(not structures) and defined constants **********************************************/
21 #ifdef ENABLE_NLS
22 #include <libintl.h>
23 #define _(String) gettext (String)
24 #ifdef gettext_noop
25 #define N_(String) gettext_noop (String)
26 #else
27 #define N_(String) (String)
28 #endif
29 #else /* Stubs that do something close enough. */
30 #define textdomain(String) 1
31 #define gettext(String) (String)
32 #define ngettext(String1,String2,Num) (((Num) == 1) ? (String1) : (String2))
33 #define dgettext(Domain,Message) (Message)
34 #define dcgettext(Domain,Message,Type) (Message)
35 #define bindtextdomain(Domain,Directory) 1
36 #define _(String) (String)
37 #define N_(String) (String)
38 #endif /* !ENABLE_NLS */
40 #ifdef HAVE_FUNC_ATTRIBUTE_FALLTHROUGH
41 #define MC_FALLTHROUGH __attribute__((fallthrough))
42 #else
43 #define MC_FALLTHROUGH
44 #endif
46 #ifdef USE_MAINTAINER_MODE
47 #include "lib/logging.h"
48 #endif
50 /* Just for keeping Your's brains from invention a proper size of the buffer :-) */
51 #define BUF_10K 10240L
52 #define BUF_8K 8192L
53 #define BUF_4K 4096L
54 #define BUF_1K 1024L
56 #define BUF_LARGE BUF_1K
57 #define BUF_MEDIUM 512
58 #define BUF_SMALL 128
59 #define BUF_TINY 64
61 #define UTF8_CHAR_LEN 6
63 /* Used to distinguish between a normal MC termination and */
64 /* one caused by typing 'exit' or 'logout' in the subshell */
65 #define SUBSHELL_EXIT 128
67 #define MC_ERROR g_quark_from_static_string (PACKAGE)
69 #define DEFAULT_CHARSET "ASCII"
71 /*** enums ***************************************************************************************/
73 /* run mode and params */
74 typedef enum
76 MC_RUN_FULL = 0,
77 MC_RUN_EDITOR,
78 MC_RUN_VIEWER,
79 MC_RUN_DIFFVIEWER
80 } mc_run_mode_t;
82 /*** structures declarations (and typedefs of structures)*****************************************/
84 typedef struct
86 const char *mc_version;
88 mc_run_mode_t mc_run_mode;
89 gboolean run_from_parent_mc;
90 /* Used so that widgets know if they are being destroyed or shut down */
91 gboolean midnight_shutdown;
93 /* sysconfig_dir: Area for default settings from maintainers of distributuves
94 default is /etc/mc or may be defined by MC_DATADIR */
95 char *sysconfig_dir;
96 /* share_data_dir: Area for default settings from developers */
97 char *share_data_dir;
99 char *profile_name;
101 mc_config_t *main_config;
102 mc_config_t *panels_config;
104 #ifdef HAVE_CHARSET
105 /* Numbers of (file I/O) and (input/display) codepages. -1 if not selected */
106 int source_codepage;
107 int display_codepage;
108 #else
109 /* If true, allow characters in the range 160-255 */
110 gboolean eight_bit_clean;
112 * If true, also allow characters in the range 128-159.
113 * This is reported to break on many terminals (xterm, qansi-m).
115 gboolean full_eight_bits;
116 #endif /* !HAVE_CHARSET */
118 * If utf-8 terminal utf8_display = TRUE
119 * Display bits set UTF-8
121 gboolean utf8_display;
123 /* Set if the nice message (hint) bar is visible */
124 gboolean message_visible;
125 /* Set if the nice and useful keybar is visible */
126 gboolean keybar_visible;
128 #ifdef ENABLE_BACKGROUND
129 /* If true, this is a background process */
130 gboolean we_are_background;
131 #endif /* ENABLE_BACKGROUND */
133 struct
135 /* Asks for confirmation before clean up of history */
136 gboolean confirm_history_cleanup;
138 /* Set if you want the possible completions dialog for the first time */
139 gboolean show_all_if_ambiguous;
141 /* Ugly hack in order to distinguish between left and right panel in menubar */
142 /* Set if the command is being run from the "Right" menu */
143 gboolean is_right; /* If the selected menu was the right */
144 } widget;
146 /* The user's shell */
147 mc_shell_t *shell;
149 struct
151 /* Use the specified skin */
152 char *skin;
153 /* Dialog window and drop down menu have a shadow */
154 gboolean shadows;
156 char *setup_color_string;
157 char *term_color_string;
158 char *color_terminal_string;
159 /* colors specified on the command line: they override any other setting */
160 char *command_line_colors;
162 #ifndef LINUX_CONS_SAVER_C
163 /* Used only in mc, not in cons.saver */
164 char console_flag;
165 #endif /* !LINUX_CONS_SAVER_C */
166 /* If using a subshell for evaluating commands this is true */
167 gboolean use_subshell;
169 #ifdef ENABLE_SUBSHELL
170 /* File descriptors of the pseudoterminal used by the subshell */
171 int subshell_pty;
172 #endif /* !ENABLE_SUBSHELL */
174 /* This flag is set by xterm detection routine in function main() */
175 /* It is used by function toggle_subshell() */
176 gboolean xterm_flag;
178 /* disable x11 support */
179 gboolean disable_x11;
181 /* For slow terminals */
182 /* If true lines are shown by spaces */
183 gboolean slow_terminal;
185 /* Set to force black and white display at program startup */
186 gboolean disable_colors;
188 /* If true use +, -, | for line drawing */
189 gboolean ugly_line_drawing;
191 /* Tries to use old highlight mouse tracking */
192 gboolean old_mouse;
194 /* If true, use + and \ keys normally and select/unselect do if M-+ / M-\.
195 and M-- and keypad + / - */
196 gboolean alternate_plus_minus;
197 } tty;
199 struct
201 /* Set when cd symlink following is desirable (bash mode) */
202 gboolean cd_symlinks;
204 /* Preallocate space before file copying */
205 gboolean preallocate_space;
207 } vfs;
208 } mc_global_t;
210 /*** global variables defined in .c file *********************************************************/
212 extern mc_global_t mc_global;
214 /*** declarations of public functions ************************************************************/
216 /*** inline functions ****************************************************************************/
217 #endif