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
11 * \author André Pönitz
15 * Full author contact details are available in file CREDITS.
23 #include "support/Length.h"
24 #include "support/strfwd.h"
25 #include "support/userinfo.h"
34 namespace support { class FileName; }
38 /// This contains the runtime configuration of LyX
43 RC_ACCEPT_COMPOUND = 1,
45 RC_AUTOCORRECTION_MATH,
51 RC_BIBTEX_ALTERNATIVES,
54 RC_BOOKMARKS_VISIBILITY,
58 RC_CITATION_SEARCH_PATTERN,
59 RC_CITATION_SEARCH_VIEW,
60 RC_COMPLETION_CURSOR_TEXT,
61 RC_COMPLETION_INLINE_DELAY,
62 RC_COMPLETION_INLINE_MATH,
63 RC_COMPLETION_INLINE_TEXT,
64 RC_COMPLETION_INLINE_DOTS,
65 RC_COMPLETION_MINLENGTH,
66 RC_COMPLETION_POPUP_DELAY,
67 RC_COMPLETION_POPUP_MATH,
68 RC_COMPLETION_POPUP_TEXT,
69 RC_COMPLETION_POPUP_AFTER_COMPLETE,
71 RC_CONVERTER_CACHE_MAXAGE,
73 RC_CT_ADDITIONS_UNDERLINED,
75 RC_CURSOR_FOLLOWS_SCROLLBAR,
77 RC_DEFAULT_DECIMAL_SEP,
78 RC_DEFAULT_LENGTH_UNIT,
79 RC_DEFAULT_OTF_VIEW_FORMAT,
80 RC_DEFAULT_PLATEX_VIEW_FORMAT,
81 RC_DEFAULT_VIEW_FORMAT,
83 RC_DIALOGS_ICONIFY_WITH_MAIN,
86 RC_EDITOR_ALTERNATIVES,
91 RC_FORWARD_SEARCH_DVI,
92 RC_FORWARD_SEARCH_PDF,
94 RC_FULL_SCREEN_SCROLLBAR,
95 RC_FULL_SCREEN_STATUSBAR,
96 RC_FULL_SCREEN_TABBAR,
97 RC_FULL_SCREEN_MENUBAR,
98 RC_FULL_SCREEN_TOOLBARS,
105 RC_INDEX_ALTERNATIVES,
108 RC_JBIBTEX_ALTERNATIVES,
114 RC_LANGUAGE_AUTO_BEGIN,
115 RC_LANGUAGE_AUTO_END,
116 RC_LANGUAGE_COMMAND_BEGIN,
117 RC_LANGUAGE_COMMAND_END,
118 RC_LANGUAGE_COMMAND_LOCAL,
119 RC_LANGUAGE_GLOBAL_OPTIONS,
120 RC_LANGUAGE_CUSTOM_PACKAGE,
121 RC_LANGUAGE_PACKAGE_SELECTION,
125 RC_MAC_DONTSWAP_CTRL_META,
126 RC_MAC_LIKE_CURSOR_MOVEMENT,
128 RC_MARK_FOREIGN_LANGUAGE,
129 RC_MOUSE_WHEEL_SPEED,
130 RC_MOUSE_MIDDLEBUTTON_PASTE,
133 RC_OPEN_BUFFERS_IN_TABS,
134 RC_PARAGRAPH_MARKERS,
136 RC_PLAINTEXT_LINELEN,
138 RC_PREVIEW_HASHED_LABELS,
139 RC_PREVIEW_SCALE_FACTOR,
140 RC_PRINTLANDSCAPEFLAG,
141 RC_PRINTPAPERDIMENSIONFLAG,
143 RC_PYGMENTIZE_COMMAND,
144 RC_RESPECT_OS_KBD_LANGUAGE,
148 RC_SCREEN_FONT_ROMAN,
149 RC_SCREEN_FONT_ROMAN_FOUNDRY,
151 RC_SCREEN_FONT_SANS_FOUNDRY,
152 RC_SCREEN_FONT_SCALABLE,
153 RC_SCREEN_FONT_SIZES,
154 RC_SCREEN_FONT_TYPEWRITER,
155 RC_SCREEN_FONT_TYPEWRITER_FOUNDRY,
157 RC_SCROLL_BELOW_DOCUMENT,
158 RC_SCROLL_WHEEL_ZOOM,
162 RC_SINGLE_CLOSE_TAB_BUTTON,
165 RC_SPELLCHECK_CONTINUOUSLY,
168 RC_SPLITINDEX_COMMAND,
171 RC_TEX_ALLOWS_SPACES,
172 RC_TEX_EXPECTS_WINDOWS_PATHS,
180 RC_USE_CONVERTER_CACHE,
181 RC_USE_CONVERTER_NEEDAUTH_FORBIDDEN,
182 RC_USE_CONVERTER_NEEDAUTH,
183 RC_USE_NATIVE_FILEDIALOG,
184 RC_USE_SYSTEM_COLORS,
186 RC_USE_SYSTEM_THEME_ICONS,
187 RC_VIEWDVI_PAPEROPTION,
189 RC_VIEWER_ALTERNATIVES,
191 RC_CLOSE_BUFFER_WITH_LAST_VIEW,
196 LyXRC() : user_name(support::user_name()),
197 user_email(support::user_email()) // always empty
200 /// \param check_format: whether to try to convert the file format,
201 /// if it is not current. this should only be true, really, for the
202 /// user's own preferences file.
203 bool read(support::FileName const & filename, bool check_format);
205 bool read(std::istream &);
213 ReturnValues read(Lexer &, bool check_format);
216 typedef std::set<std::string> CommandSet;
217 /// maps a format to a set of commands that can be used to
219 typedef std::map<std::string, CommandSet> Alternatives;
221 void write(support::FileName const & filename,
222 bool ignore_system_lyxrc) const;
223 /// write rc. If a specific tag is given, only output that one.
224 void write(std::ostream & os,
225 bool ignore_system_lyxrc,
226 std::string const & tag = std::string()) const;
230 std::set<std::string> getRCs();
231 // FIXME unused (was used for xforms. Do we still need this?)
232 //static docstring const getDescription(LyXRCTags);
234 std::string bind_file = "cua";
236 std::string def_file = "default";
238 std::string ui_file = "default";
240 std::string print_landscape_flag = "-t landscape";
242 std::string print_paper_flag = "-t";
244 std::string print_paper_dimension_flag = "-T";
245 /// option for telling the dvi viewer about the paper size
246 std::string view_dvi_paper_option;
247 /// default paper size for local xdvi/dvips/ghostview/whatever
248 /// command to run chktex incl. options
249 std::string chktex_command = "chktex -n1 -n3 -n6 -n9 -n22 -n25 -n30 -n38";
250 /// Use external script to search for file corresponding to a
252 bool citation_search = false;
253 /// Name of external script which searches for file corresponding to a
254 /// given citation. At this moment only script lyxpaperview.p is supported
255 /// (search for pdf or ps based on specific items)
256 std::string citation_search_view;
257 /// Items to search for in citation_search_view
258 std::string citation_search_pattern = "%year% %abbrvciteauthor%";
259 /// all available commands to run bibtex incl. options
260 CommandSet bibtex_alternatives;
261 /// command to run bibtex incl. options
262 std::string bibtex_command = "automatic";
263 /// command to run japanese bibtex incl. options
264 std::string jbibtex_command;
265 /// all available commands to run japanese bibtex incl. options
266 CommandSet jbibtex_alternatives;
267 /// all available index commands incl. options
268 CommandSet index_alternatives;
269 /// command to run makeindex incl. options or other index programs
270 std::string index_command = "makeindex -c -q";
271 /// command to run japanese index program incl. options
272 std::string jindex_command;
273 /// command to generate multiple indices
274 std::string splitindex_command;
275 /// command to run makeindex incl. options for nomencl
276 std::string nomencl_command = "makeindex -s nomencl.ist";
277 /// command to run the python pygments syntax highlighter
278 std::string pygmentize_command;
280 std::string document_path;
282 std::string example_path;
284 std::string template_path;
286 std::string tempdir_path;
288 std::string thesaurusdir_path;
290 std::string hunspelldir_path;
292 bool auto_region_delete = true;
293 /// enable middle-mouse-button paste
294 bool mouse_middlebutton_paste = true;
296 bool auto_reset_options = false;
297 /// flag telling whether lastfiles should be checked for existance
298 bool check_lastfiles = true;
299 /// maximal number of lastfiles
300 unsigned int num_lastfiles = 20;
301 /// whether or not go to saved position when opening a file
302 bool use_lastfilepos = true;
303 /// load files from last session automatically
304 bool load_session = false;
305 /// do we save new documents as compressed by default
306 bool save_compressed = false;
307 /// whether or not to save the document dir in the file
308 bool save_origin = false;
309 /// shall a backup file be created
310 bool make_backup = true;
311 /// A directory for storing backup files
312 std::string backupdir_path;
313 /// Whether or not save/restore session information
314 /// like windows position and geometry.
315 bool allow_geometry_session = true;
316 /// Scrolling speed of the mouse wheel
317 double mouse_wheel_speed = 1.0;
318 /// Default zoom factor for screen fonts
319 int defaultZoom = 150;
320 /// Actual zoom factor for screen fonts
321 /// (default zoom plus buffer zoom factor)
322 /// Do not set directly. Use GuiView::setCurrentZoom()
323 int currentZoom = 150;
324 /// Screen font sizes in points for each font size
325 std::string font_sizes[10] = { "5.0", "7.0", "8.0", "9.0", "10.0",
326 "12.0", "14.4", "17.26", "20.74", "24.88"};
327 /// Allow the use of scalable fonts? Default is yes.
328 bool use_scalable_fonts = true;
330 unsigned int dpi = 75;
332 std::string roman_font_name;
334 std::string sans_font_name;
336 std::string typewriter_font_name;
338 std::string roman_font_foundry;
340 std::string sans_font_foundry;
342 std::string typewriter_font_foundry;
344 unsigned int autosave = 300;
346 unsigned int plaintext_linelen = 65;
347 /// End of paragraph markers?
348 bool paragraph_markers = false;
350 bool use_tooltip = true;
351 /// Use the colors from current system theme?
352 bool use_system_colors = false;
353 /// use native file dialog or our own ?
354 bool use_native_filedialog = true;
355 /// Spellchecker engine: aspell, hunspell, etc
356 std::string spellchecker
357 #if defined(USE_MACOSX_PACKAGING)
359 #elif defined(USE_ENCHANT)
361 #elif defined(USE_ASPELL)
363 #elif defined(USE_HUNSPELL)
368 /// Alternate language for spellchecker
369 std::string spellchecker_alt_lang;
370 /// Escape characters
371 std::string spellchecker_esc_chars;
372 /// Accept compound words in spellchecker?
373 bool spellchecker_accept_compound = false;
374 /// spellcheck continuously?
375 bool spellcheck_continuously = true;
376 /// spellcheck notes and comments?
377 bool spellcheck_notes = true;
379 bool use_kbmap = false;
381 std::string primary_kbmap;
383 std::string secondary_kbmap;
385 std::string lyxpipes;
387 std::string language_custom_package = "\\usepackage{babel}";
389 bool language_auto_begin = true;
391 bool language_auto_end = true;
393 std::string language_command_begin = "\\selectlanguage{$$lang}";
395 std::string language_command_end;
397 std::string language_command_local = "\\foreignlanguage{$$lang}{";
399 bool language_global_options = true;
401 enum LangPackageSelection {
408 LangPackageSelection language_package_selection = LP_AUTO;
409 /// bidi cursor movement: true = visual, false = logical
410 bool visual_cursor = false;
412 bool auto_number = true;
414 bool mark_foreign_language = true;
416 std::string gui_language = "auto";
418 bool respect_os_kbd_language = false;
420 std::string default_otf_view_format = "pdf4";
422 std::string default_platex_view_format = "pdf3";
424 std::string default_view_format = "pdf2";
425 /// all available viewers
426 Alternatives viewer_alternatives;
427 /// all available editors
428 Alternatives editor_alternatives;
430 bool mac_dontswap_ctrl_meta = false;
432 bool mac_like_cursor_movement = false;
434 bool cursor_follows_scrollbar = false;
436 bool ct_additions_underlined = true;
438 bool ct_markup_copied = false;
440 bool scroll_below_document = false;
442 enum MacroEditStyle {
443 MACRO_EDIT_INLINE_BOX = 0,
448 MacroEditStyle macro_edit_style = MACRO_EDIT_INLINE_BOX;
450 bool dialogs_iconify_with_main = false;
452 bool display_graphics = true;
454 bool show_banner = true;
462 PreviewStatus preview = PREVIEW_OFF;
464 bool preview_hashed_labels = false;
466 double preview_scale_factor = 1.0;
468 std::string user_name; // set in constructor
470 std::string user_email; // set in constructor (empty for now)
472 std::string user_initials;
474 std::string icon_set;
475 /// whether to use the icons from the theme
476 bool use_system_theme_icons = false;
477 /// True if the TeX engine cannot handle posix paths
478 bool windows_style_tex_paths = false;
479 /// True if the TeX engine can handle file names containing spaces
480 bool tex_allows_spaces = false;
481 /** Prepend paths to the PATH environment variable.
482 * The string is input, stored and output in native format.
484 std::string path_prefix;
485 /** Prepend paths to the TEXINPUTS environment variable.
486 * The string is input, stored and output in native format.
487 * A '.' here stands for the current document directory.
489 std::string texinputs_prefix = ".";
490 /// Use the cache for file converters?
491 bool use_converter_cache = true;
492 /// Forbid use of external converters with 'needauth' option
493 bool use_converter_needauth_forbidden = true;
494 /// Ask user before calling external converters with 'needauth' option
495 bool use_converter_needauth = true;
496 /// The maximum age of cache files in seconds
497 unsigned int converter_cache_maxage = 6 * 30 * 24 * 3600; // 6 months;
498 /// Sort layouts alphabetically
499 bool sort_layouts = false;
500 /// Group layout by their category
501 bool group_layouts = true;
502 /// Toggle toolbars in fullscreen mode?
503 bool full_screen_toolbars = true;
504 /// Toggle scrollbar in fullscreen mode?
505 bool full_screen_scrollbar = true;
506 /// Toggle tabbar in fullscreen mode?
507 bool full_screen_tabbar = true;
508 /// Toggle menubar in fullscreen mode?
509 bool full_screen_menubar = true;
510 /// Toggle statusbar in fullscreen mode?
511 bool full_screen_statusbar = true;
512 /// Limit the text width?
513 bool full_screen_limit = false;
514 /// Width of limited screen (in pixels) in fullscreen mode
515 int full_screen_width = 700;
517 bool completion_cursor_text = true;
519 double completion_inline_delay = 0.2;
521 bool completion_inline_math = true;
523 bool completion_inline_text = false;
525 int completion_inline_dots = -1;
526 /// minimum length of words to complete
527 unsigned int completion_minlength = 6;
529 double completion_popup_delay = 2.0;
531 bool completion_popup_math = true;
533 bool completion_popup_text = false;
535 bool completion_popup_after_complete = true;
537 bool autocorrection_math = false;
539 bool open_buffers_in_tabs = true;
541 bool single_close_tab_button = false;
543 bool single_instance = true;
545 std::string forward_search_dvi;
547 std::string forward_search_pdf;
549 int export_overwrite = NO_FILES;
550 /// Default decimal point when aligning table columns on decimal
551 std::string default_decimal_sep = "locale";
553 Length::UNIT default_length_unit = Length::CM;
555 enum ScrollWheelZoom {
556 SCROLL_WHEEL_ZOOM_OFF,
557 SCROLL_WHEEL_ZOOM_CTRL,
558 SCROLL_WHEEL_ZOOM_SHIFT,
559 SCROLL_WHEEL_ZOOM_ALT
562 ScrollWheelZoom scroll_wheel_zoom = SCROLL_WHEEL_ZOOM_CTRL;
563 // FIXME: should be caret_width
565 int cursor_width = 0;
566 /// One of: yes, no, ask
567 std::string close_buffer_with_last_view = "yes";
568 enum BookmarksVisibility {
575 BookmarksVisibility bookmarks_visibility = BMK_NONE;
579 void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new);
584 extern LyXRC system_lyxrc;
586 // used by at least frontends/qt/GuiPref.cpp
587 const long maxlastfiles = 50;