global.h 6.2 KB

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