tufte layout files:
[lyx.git] / src / LyXRC.h
blobaf28ce0129a2cfe53c35786b69bfa2d5812790b5
1 // -*- C++ -*-
2 /**
3 * \file LyXRC.h
4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Lars Gullik Bjønnes
8 * \author Jean-Marc Lasgouttes
9 * \author Angus Leeming
10 * \author John Levon
11 * \author André Pönitz
12 * \author Allan Rae
13 * \author Dekel Tsur
15 * Full author contact details are available in file CREDITS.
18 #ifndef LYXRC_H
19 #define LYXRC_H
21 #include "paper.h"
23 #include "support/strfwd.h"
25 #include <map>
26 #include <set>
27 #include <string>
28 #include <vector>
31 namespace lyx {
33 namespace support { class FileName; }
35 class Lexer;
37 /// This contains the runtime configuration of LyX
38 class LyXRC
40 public:
41 enum LyXRCTags {
42 RC_ACCEPT_COMPOUND = 1,
43 RC_ALT_LANG,
44 RC_AUTOCORRECTION_MATH,
45 RC_AUTOREGIONDELETE,
46 RC_AUTORESET_OPTIONS,
47 RC_AUTOSAVE,
48 RC_AUTO_NUMBER,
49 RC_BACKUPDIR_PATH,
50 RC_BIBTEX_ALTERNATIVES,
51 RC_BIBTEX_COMMAND,
52 RC_BINDFILE,
53 RC_CHECKLASTFILES,
54 RC_CHKTEX_COMMAND,
55 RC_COMPLETION_CURSOR_TEXT,
56 RC_COMPLETION_INLINE_DELAY,
57 RC_COMPLETION_INLINE_MATH,
58 RC_COMPLETION_INLINE_TEXT,
59 RC_COMPLETION_INLINE_DOTS,
60 RC_COMPLETION_POPUP_DELAY,
61 RC_COMPLETION_POPUP_MATH,
62 RC_COMPLETION_POPUP_TEXT,
63 RC_COMPLETION_POPUP_AFTER_COMPLETE,
64 RC_CONVERTER,
65 RC_CONVERTER_CACHE_MAXAGE,
66 RC_COPIER,
67 RC_CURSOR_FOLLOWS_SCROLLBAR,
68 RC_DATE_INSERT_FORMAT,
69 RC_DEFAULT_LANGUAGE,
70 RC_DEFAULT_VIEW_FORMAT,
71 RC_DEFAULT_PAPERSIZE,
72 RC_DEFFILE,
73 RC_DIALOGS_ICONIFY_WITH_MAIN,
74 RC_DISPLAY_GRAPHICS,
75 RC_DOCUMENTPATH,
76 RC_EDITOR_ALTERNATIVES,
77 RC_ESC_CHARS,
78 RC_EXAMPLEPATH,
79 RC_FONT_ENCODING,
80 RC_FORMAT,
81 RC_FULL_SCREEN_LIMIT,
82 RC_FULL_SCREEN_SCROLLBAR,
83 RC_FULL_SCREEN_TABBAR,
84 RC_FULL_SCREEN_MENUBAR,
85 RC_FULL_SCREEN_TOOLBARS,
86 RC_FULL_SCREEN_WIDTH,
87 RC_GEOMETRY_SESSION,
88 RC_GROUP_LAYOUTS,
89 RC_GUI_LANGUAGE,
90 RC_HUNSPELLDIR_PATH,
91 RC_INDEX_ALTERNATIVES,
92 RC_INDEX_COMMAND,
93 RC_INPUT,
94 RC_JBIBTEX_COMMAND,
95 RC_JINDEX_COMMAND,
96 RC_KBMAP,
97 RC_KBMAP_PRIMARY,
98 RC_KBMAP_SECONDARY,
99 RC_LABEL_INIT_LENGTH,
100 RC_LANGUAGE_AUTO_BEGIN,
101 RC_LANGUAGE_AUTO_END,
102 RC_LANGUAGE_COMMAND_BEGIN,
103 RC_LANGUAGE_COMMAND_END,
104 RC_LANGUAGE_COMMAND_LOCAL,
105 RC_LANGUAGE_GLOBAL_OPTIONS,
106 RC_LANGUAGE_PACKAGE,
107 RC_LANGUAGE_USE_BABEL,
108 RC_LOADSESSION,
109 RC_MACRO_EDIT_STYLE,
110 RC_MAC_LIKE_WORD_MOVEMENT,
111 RC_MAKE_BACKUP,
112 RC_MARK_FOREIGN_LANGUAGE,
113 RC_MOUSE_WHEEL_SPEED,
114 RC_NOMENCL_COMMAND,
115 RC_NUMLASTFILES,
116 RC_OPEN_BUFFERS_IN_TABS,
117 RC_PARAGRAPH_MARKERS,
118 RC_PATH_PREFIX,
119 RC_PERS_DICT,
120 RC_PLAINTEXT_LINELEN,
121 RC_PLAINTEXT_ROFF_COMMAND,
122 RC_PREVIEW,
123 RC_PREVIEW_HASHED_LABELS,
124 RC_PREVIEW_SCALE_FACTOR,
125 RC_PRINTCOLLCOPIESFLAG,
126 RC_PRINTCOPIESFLAG,
127 RC_PRINTER,
128 RC_PRINTEVENPAGEFLAG,
129 RC_PRINTEXSTRAOPTIONS,
130 RC_PRINTFILEEXTENSION,
131 RC_PRINTLANDSCAPEFLAG,
132 RC_PRINTODDPAGEFLAG,
133 RC_PRINTPAGERANGEFLAG,
134 RC_PRINTPAPERDIMENSIONFLAG,
135 RC_PRINTPAPERFLAG,
136 RC_PRINTREVERSEFLAG,
137 RC_PRINTSPOOL_COMMAND,
138 RC_PRINTSPOOL_PRINTERPREFIX,
139 RC_PRINTTOFILE,
140 RC_PRINTTOPRINTER,
141 RC_PRINT_ADAPTOUTPUT,
142 RC_PRINT_COMMAND,
143 RC_RTL_SUPPORT,
144 RC_SCREEN_DPI,
145 RC_SCREEN_FONT_ROMAN,
146 RC_SCREEN_FONT_ROMAN_FOUNDRY,
147 RC_SCREEN_FONT_SANS,
148 RC_SCREEN_FONT_SANS_FOUNDRY,
149 RC_SCREEN_FONT_SCALABLE,
150 RC_SCREEN_FONT_SIZES,
151 RC_SCREEN_FONT_TYPEWRITER,
152 RC_SCREEN_FONT_TYPEWRITER_FOUNDRY,
153 RC_SCREEN_ZOOM,
154 RC_SCROLL_BELOW_DOCUMENT,
155 RC_SERVERPIPE,
156 RC_SET_COLOR,
157 RC_SHOW_BANNER,
158 RC_SINGLE_CLOSE_TAB_BUTTON,
159 RC_SORT_LAYOUTS,
160 RC_SPELL_COMMAND,
161 RC_SPELLCHECK_CONTINUOUSLY,
162 RC_SPELLCHECKER,
163 RC_SPLITINDEX_COMMAND,
164 RC_TEMPDIRPATH,
165 RC_TEMPLATEPATH,
166 RC_TEX_ALLOWS_SPACES,
167 RC_TEX_EXPECTS_WINDOWS_PATHS,
168 RC_THESAURUSDIRPATH,
169 RC_UIFILE,
170 RC_USELASTFILEPOS,
171 RC_USER_EMAIL,
172 RC_USER_NAME,
173 RC_USETEMPDIR,
174 RC_USE_ALT_LANG,
175 RC_USE_CONVERTER_CACHE,
176 RC_USE_ESC_CHARS,
177 RC_USE_INP_ENC,
178 RC_USE_PERS_DICT,
179 RC_USE_TOOLTIP,
180 RC_USE_PIXMAP_CACHE,
181 RC_USE_SPELL_LIB,
182 RC_VIEWDVI_PAPEROPTION,
183 RC_VIEWER,
184 RC_VIEWER_ALTERNATIVES,
185 RC_VISUAL_CURSOR,
186 RC_LAST
190 LyXRC();
192 void setDefaults();
194 int read(support::FileName const & filename);
196 int read(std::istream &);
197 private:
199 int read(Lexer &);
200 public:
201 ///
202 typedef std::set<std::string> CommandSet;
203 /// maps a format to a set of commands that can be used to
204 /// edit or view it.
205 typedef std::map<std::string, CommandSet> Alternatives;
207 void write(support::FileName const & filename,
208 bool ignore_system_lyxrc) const;
209 /// write rc. If a specific tag is given, only output that one.
210 void write(std::ostream & os,
211 bool ignore_system_lyxrc,
212 std::string const & tag = std::string()) const;
214 void print() const;
215 // FIXME unused (was used for xforms. Do we still need this?)
216 //static docstring const getDescription(LyXRCTags);
218 std::string bind_file;
220 std::string def_file;
222 std::string ui_file;
224 std::string printer;
226 std::string print_command;
228 std::string print_evenpage_flag;
230 std::string print_oddpage_flag;
232 std::string print_pagerange_flag;
234 std::string print_copies_flag;
236 std::string print_collcopies_flag;
238 std::string print_reverse_flag;
240 std::string print_landscape_flag;
242 std::string print_to_printer;
244 bool print_adapt_output;
246 std::string print_to_file;
248 std::string print_file_extension;
250 std::string print_extra_options;
252 std::string print_spool_command;
254 std::string print_spool_printerprefix;
256 std::string print_paper_flag;
258 std::string print_paper_dimension_flag;
259 /// option for telling the dvi viewer about the paper size
260 std::string view_dvi_paper_option;
261 /// default paper size for local xdvi/dvips/ghostview/whatever
262 PAPER_SIZE default_papersize;
263 /// command to run chktex incl. options
264 std::string chktex_command;
265 /// all available commands to run bibtex incl. options
266 CommandSet bibtex_alternatives;
267 /// command to run bibtex incl. options
268 std::string bibtex_command;
269 /// command to run japanese bibtex incl. options
270 std::string jbibtex_command;
271 /// all available index commands incl. options
272 CommandSet index_alternatives;
273 /// command to run makeindex incl. options or other index programs
274 std::string index_command;
275 /// command to run japanese index program incl. options
276 std::string jindex_command;
277 /// command to generate multiple indices
278 std::string splitindex_command;
279 /// command to run makeindex incl. options for nomencl
280 std::string nomencl_command;
282 std::string document_path;
284 std::string example_path;
286 std::string template_path;
288 std::string tempdir_path;
290 std::string thesaurusdir_path;
292 std::string hunspelldir_path;
294 bool auto_region_delete;
295 /// flag telling whether lastfiles should be checked for existance
296 bool auto_reset_options;
298 bool check_lastfiles;
299 /// maximal number of lastfiles
300 unsigned int num_lastfiles;
301 /// whether or not go to saved position when opening a file
302 bool use_lastfilepos;
303 /// load files from last session automatically
304 bool load_session;
305 /// shall a backup file be created
306 bool make_backup;
307 /// A directory for storing backup files
308 std::string backupdir_path;
309 /// Whether or not save/restore session information
310 /// like windows position and geometry.
311 bool allow_geometry_session;
312 /// Scrolling speed of the mouse wheel
313 double mouse_wheel_speed;
314 /// Zoom factor for screen fonts
315 unsigned int zoom;
316 /// Screen font sizes in points for each font size
317 std::string font_sizes[10];
318 /// Allow the use of scalable fonts? Default is yes.
319 bool use_scalable_fonts;
320 /// DPI of monitor
321 unsigned int dpi;
323 std::string fontenc;
325 std::string roman_font_name;
327 std::string sans_font_name;
329 std::string typewriter_font_name;
331 std::string roman_font_foundry;
333 std::string sans_font_foundry;
335 std::string typewriter_font_foundry;
337 unsigned int autosave;
339 unsigned int plaintext_linelen;
340 /// Accept compound words in spellchecker?
341 bool spellchecker_accept_compound;
342 /// End of paragraph markers?
343 bool paragraph_markers;
344 /// Use tooltips?
345 bool use_tooltip;
346 /// Use pixmap cache?
347 bool use_pixmap_cache;
348 /// Spellchecker engine: aspell, hunspell, etc
349 std::string spellchecker;
350 /// Alternate language for spellchecker
351 std::string spellchecker_alt_lang;
352 /// Escape characters
353 std::string spellchecker_esc_chars;
354 /// spellcheck continuously?
355 bool spellcheck_continuously;
357 bool use_kbmap;
359 std::string primary_kbmap;
361 std::string secondary_kbmap;
363 std::string lyxpipes;
365 std::string date_insert_format;
367 std::string language_package;
369 bool language_auto_begin;
371 bool language_auto_end;
373 std::string language_command_begin;
375 std::string language_command_end;
377 std::string language_command_local;
379 bool language_global_options;
381 bool language_use_babel;
383 bool rtl_support;
384 /// bidi cursor movement: true = visual, false = logical
385 bool visual_cursor;
387 bool auto_number;
389 bool mark_foreign_language;
391 std::string default_language;
393 std::string gui_language;
395 std::string default_view_format;
396 /// all available viewers
397 Alternatives viewer_alternatives;
398 /// all available editors
399 Alternatives editor_alternatives;
401 bool mac_like_word_movement;
403 bool cursor_follows_scrollbar;
405 bool scroll_below_document;
407 enum MacroEditStyle {
408 MACRO_EDIT_INLINE_BOX = 0,
409 MACRO_EDIT_INLINE,
410 MACRO_EDIT_LIST
413 MacroEditStyle macro_edit_style;
415 bool dialogs_iconify_with_main;
417 int label_init_length;
419 bool display_graphics;
421 bool show_banner;
423 enum PreviewStatus {
424 PREVIEW_OFF,
425 PREVIEW_NO_MATH,
426 PREVIEW_ON
429 PreviewStatus preview;
431 bool preview_hashed_labels;
433 double preview_scale_factor;
434 /// user name
435 std::string user_name;
436 /// user email
437 std::string user_email;
438 /// True if the TeX engine cannot handle posix paths
439 bool windows_style_tex_paths;
440 /// True if the TeX engine can handle file names containing spaces
441 bool tex_allows_spaces;
442 /** Prepend paths to the PATH environment variable.
443 * The string is input, stored and output in native format.
445 std::string path_prefix;
446 /// Use the cache for file converters?
447 bool use_converter_cache;
448 /// The maximum age of cache files in seconds
449 unsigned int converter_cache_maxage;
450 /// Sort layouts alphabetically
451 bool sort_layouts;
452 /// Group layout by their category
453 bool group_layouts;
454 /// Toggle toolbars in fullscreen mode?
455 bool full_screen_toolbars;
456 /// Toggle scrollbar in fullscreen mode?
457 bool full_screen_scrollbar;
458 /// Toggle tabbar in fullscreen mode?
459 bool full_screen_tabbar;
460 /// Toggle menubar in fullscreen mode?
461 bool full_screen_menubar;
462 /// Limit the text width?
463 bool full_screen_limit;
464 /// Width of limited screen (in pixels) in fullscreen mode
465 int full_screen_width;
467 bool completion_cursor_text;
469 double completion_inline_delay;
471 bool completion_inline_math;
473 bool completion_inline_text;
475 int completion_inline_dots;
477 bool autocorrection_math;
479 double completion_popup_delay;
481 bool completion_popup_math;
483 bool completion_popup_text;
485 bool completion_popup_after_complete;
487 bool open_buffers_in_tabs;
489 bool single_close_tab_button;
493 /** \c LyXRC_PreviewStatus is a wrapper for LyXRC::PreviewStatus.
494 * It can be forward-declared and passed as a function argument without
495 * having to expose LyXRC.h.
497 class LyXRC_PreviewStatus {
498 LyXRC::PreviewStatus val_;
499 public:
500 LyXRC_PreviewStatus(LyXRC::PreviewStatus val) : val_(val) {}
501 operator LyXRC::PreviewStatus() const { return val_; }
504 void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new);
507 extern LyXRC lyxrc;
509 extern LyXRC system_lyxrc;
511 // used by at least frontends/qt4/GuiPref.cpp
512 const long maxlastfiles = 20;
514 } // namespace lyx
516 #endif