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