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,
56 RC_CITATION_SEARCH_VIEW,
57 RC_COMPLETION_CURSOR_TEXT,
58 RC_COMPLETION_INLINE_DELAY,
59 RC_COMPLETION_INLINE_MATH,
60 RC_COMPLETION_INLINE_TEXT,
61 RC_COMPLETION_INLINE_DOTS,
62 RC_COMPLETION_MINLENGTH,
63 RC_COMPLETION_POPUP_DELAY,
64 RC_COMPLETION_POPUP_MATH,
65 RC_COMPLETION_POPUP_TEXT,
66 RC_COMPLETION_POPUP_AFTER_COMPLETE,
68 RC_CONVERTER_CACHE_MAXAGE,
70 RC_CT_ADDITIONS_UNDERLINED,
72 RC_CURSOR_FOLLOWS_SCROLLBAR,
74 RC_DEFAULT_DECIMAL_SEP,
75 RC_DEFAULT_LENGTH_UNIT,
76 RC_DEFAULT_OTF_VIEW_FORMAT,
77 RC_DEFAULT_PLATEX_VIEW_FORMAT,
78 RC_DEFAULT_VIEW_FORMAT,
80 RC_DIALOGS_ICONIFY_WITH_MAIN,
83 RC_EDITOR_ALTERNATIVES,
88 RC_FORWARD_SEARCH_DVI,
89 RC_FORWARD_SEARCH_PDF,
91 RC_FULL_SCREEN_SCROLLBAR,
92 RC_FULL_SCREEN_STATUSBAR,
93 RC_FULL_SCREEN_TABBAR,
94 RC_FULL_SCREEN_MENUBAR,
95 RC_FULL_SCREEN_TOOLBARS,
102 RC_INDEX_ALTERNATIVES,
105 RC_JBIBTEX_ALTERNATIVES,
111 RC_LANGUAGE_AUTO_BEGIN,
112 RC_LANGUAGE_AUTO_END,
113 RC_LANGUAGE_COMMAND_BEGIN,
114 RC_LANGUAGE_COMMAND_END,
115 RC_LANGUAGE_COMMAND_LOCAL,
116 RC_LANGUAGE_GLOBAL_OPTIONS,
117 RC_LANGUAGE_CUSTOM_PACKAGE,
118 RC_LANGUAGE_PACKAGE_SELECTION,
122 RC_MAC_DONTSWAP_CTRL_META,
123 RC_MAC_LIKE_CURSOR_MOVEMENT,
125 RC_MARK_FOREIGN_LANGUAGE,
126 RC_MOUSE_WHEEL_SPEED,
127 RC_MOUSE_MIDDLEBUTTON_PASTE,
130 RC_OPEN_BUFFERS_IN_TABS,
131 RC_PARAGRAPH_MARKERS,
133 RC_PLAINTEXT_LINELEN,
135 RC_PREVIEW_HASHED_LABELS,
136 RC_PREVIEW_SCALE_FACTOR,
137 RC_PRINTLANDSCAPEFLAG,
138 RC_PRINTPAPERDIMENSIONFLAG,
140 RC_PYGMENTIZE_COMMAND,
141 RC_RESPECT_OS_KBD_LANGUAGE,
145 RC_SCREEN_FONT_ROMAN,
146 RC_SCREEN_FONT_ROMAN_FOUNDRY,
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,
154 RC_SCROLL_BELOW_DOCUMENT,
155 RC_SCROLL_WHEEL_ZOOM,
159 RC_SINGLE_CLOSE_TAB_BUTTON,
162 RC_SPELLCHECK_CONTINUOUSLY,
165 RC_SPLITINDEX_COMMAND,
168 RC_TEX_ALLOWS_SPACES,
169 RC_TEX_EXPECTS_WINDOWS_PATHS,
177 RC_USE_CONVERTER_CACHE,
178 RC_USE_CONVERTER_NEEDAUTH_FORBIDDEN,
179 RC_USE_CONVERTER_NEEDAUTH,
180 RC_USE_NATIVE_FILEDIALOG,
181 RC_USE_SYSTEM_COLORS,
183 RC_USE_SYSTEM_THEME_ICONS,
184 RC_VIEWDVI_PAPEROPTION,
186 RC_VIEWER_ALTERNATIVES,
188 RC_CLOSE_BUFFER_WITH_LAST_VIEW,
193 LyXRC() : user_name(support::user_name()),
194 user_email(support::user_email()) // always empty
197 /// \param check_format: whether to try to convert the file format,
198 /// if it is not current. this should only be true, really, for the
199 /// user's own preferences file.
200 bool read(support::FileName const & filename, bool check_format);
202 bool read(std::istream &);
210 ReturnValues read(Lexer &, bool check_format);
213 typedef std::set<std::string> CommandSet;
214 /// maps a format to a set of commands that can be used to
216 typedef std::map<std::string, CommandSet> Alternatives;
218 void write(support::FileName const & filename,
219 bool ignore_system_lyxrc) const;
220 /// write rc. If a specific tag is given, only output that one.
221 void write(std::ostream & os,
222 bool ignore_system_lyxrc,
223 std::string const & tag = std::string()) const;
227 std::set<std::string> getRCs();
228 // FIXME unused (was used for xforms. Do we still need this?)
229 //static docstring const getDescription(LyXRCTags);
231 std::string bind_file = "cua";
233 std::string def_file = "default";
235 std::string ui_file = "default";
237 std::string print_landscape_flag = "-t landscape";
239 std::string print_paper_flag = "-t";
241 std::string print_paper_dimension_flag = "-T";
242 /// option for telling the dvi viewer about the paper size
243 std::string view_dvi_paper_option;
244 /// default paper size for local xdvi/dvips/ghostview/whatever
245 /// command to run chktex incl. options
246 std::string chktex_command = "chktex -n1 -n3 -n6 -n9 -n22 -n25 -n30 -n38";
247 // Name of external script, which searches for file corresponding to a
248 // given citation. At this moment only script "lyxpaperview" is supported
249 // (search for pdf based on author+year), but we can generalize if requested.
250 // Citation context menu item "Open Citation Content" will be always enabled
251 // if the name of this script in nonempty (last resort when citation entry
252 // does not contain neccessary info.
253 std::string citation_search_view;
254 /// all available commands to run bibtex incl. options
255 CommandSet bibtex_alternatives;
256 /// command to run bibtex incl. options
257 std::string bibtex_command = "automatic";
258 /// command to run japanese bibtex incl. options
259 std::string jbibtex_command;
260 /// all available commands to run japanese bibtex incl. options
261 CommandSet jbibtex_alternatives;
262 /// all available index commands incl. options
263 CommandSet index_alternatives;
264 /// command to run makeindex incl. options or other index programs
265 std::string index_command = "makeindex -c -q";
266 /// command to run japanese index program incl. options
267 std::string jindex_command;
268 /// command to generate multiple indices
269 std::string splitindex_command;
270 /// command to run makeindex incl. options for nomencl
271 std::string nomencl_command = "makeindex -s nomencl.ist";
272 /// command to run the python pygments syntax highlighter
273 std::string pygmentize_command;
275 std::string document_path;
277 std::string example_path;
279 std::string template_path;
281 std::string tempdir_path;
283 std::string thesaurusdir_path;
285 std::string hunspelldir_path;
287 bool auto_region_delete = true;
288 /// enable middle-mouse-button paste
289 bool mouse_middlebutton_paste = true;
291 bool auto_reset_options = false;
292 /// flag telling whether lastfiles should be checked for existance
293 bool check_lastfiles = true;
294 /// maximal number of lastfiles
295 unsigned int num_lastfiles = 20;
296 /// whether or not go to saved position when opening a file
297 bool use_lastfilepos = true;
298 /// load files from last session automatically
299 bool load_session = false;
300 /// do we save new documents as compressed by default
301 bool save_compressed = false;
302 /// whether or not to save the document dir in the file
303 bool save_origin = false;
304 /// shall a backup file be created
305 bool make_backup = true;
306 /// A directory for storing backup files
307 std::string backupdir_path;
308 /// Whether or not save/restore session information
309 /// like windows position and geometry.
310 bool allow_geometry_session = true;
311 /// Scrolling speed of the mouse wheel
312 double mouse_wheel_speed = 1.0;
313 /// Default zoom factor for screen fonts
314 int defaultZoom = 150;
315 /// Actual zoom factor for screen fonts
316 /// (default zoom plus buffer zoom factor)
317 int currentZoom = 150;
318 /// Screen font sizes in points for each font size
319 std::string font_sizes[10] = { "5.0", "7.0", "8.0", "9.0", "10.0",
320 "12.0", "14.4", "17.26", "20.74", "24.88"};
321 /// Allow the use of scalable fonts? Default is yes.
322 bool use_scalable_fonts = true;
324 unsigned int dpi = 75;
326 std::string roman_font_name;
328 std::string sans_font_name;
330 std::string typewriter_font_name;
332 std::string roman_font_foundry;
334 std::string sans_font_foundry;
336 std::string typewriter_font_foundry;
338 unsigned int autosave = 300;
340 unsigned int plaintext_linelen = 65;
341 /// End of paragraph markers?
342 bool paragraph_markers = false;
344 bool use_tooltip = true;
345 /// Use the colors from current system theme?
346 bool use_system_colors = false;
347 /// use native file dialog or our own ?
348 bool use_native_filedialog = true;
349 /// Spellchecker engine: aspell, hunspell, etc
350 std::string spellchecker
351 #if defined(USE_MACOSX_PACKAGING)
353 #elif defined(USE_ENCHANT)
355 #elif defined(USE_ASPELL)
357 #elif defined(USE_HUNSPELL)
362 /// Alternate language for spellchecker
363 std::string spellchecker_alt_lang;
364 /// Escape characters
365 std::string spellchecker_esc_chars;
366 /// Accept compound words in spellchecker?
367 bool spellchecker_accept_compound = false;
368 /// spellcheck continuously?
369 bool spellcheck_continuously = false;
370 /// spellcheck notes and comments?
371 bool spellcheck_notes = true;
372 /// minimum length of words to complete
373 unsigned int completion_minlength = 6;
375 bool use_kbmap = false;
377 std::string primary_kbmap;
379 std::string secondary_kbmap;
381 std::string lyxpipes;
383 std::string language_custom_package = "\\usepackage{babel}";
385 bool language_auto_begin = true;
387 bool language_auto_end = true;
389 std::string language_command_begin = "\\selectlanguage{$$lang}";
391 std::string language_command_end;
393 std::string language_command_local = "\\foreignlanguage{$$lang}{";
395 bool language_global_options = true;
397 enum LangPackageSelection {
404 LangPackageSelection language_package_selection = LP_AUTO;
405 /// bidi cursor movement: true = visual, false = logical
406 bool visual_cursor = false;
408 bool auto_number = true;
410 bool mark_foreign_language = true;
412 std::string gui_language = "auto";
414 bool respect_os_kbd_language = false;
416 std::string default_otf_view_format = "pdf4";
418 std::string default_platex_view_format = "pdf3";
420 std::string default_view_format = "pdf2";
421 /// all available viewers
422 Alternatives viewer_alternatives;
423 /// all available editors
424 Alternatives editor_alternatives;
426 bool mac_dontswap_ctrl_meta = false;
428 bool mac_like_cursor_movement = false;
430 bool cursor_follows_scrollbar = false;
432 bool ct_additions_underlined = true;
434 bool ct_markup_copied = false;
436 bool scroll_below_document = false;
438 enum MacroEditStyle {
439 MACRO_EDIT_INLINE_BOX = 0,
444 MacroEditStyle macro_edit_style = MACRO_EDIT_INLINE_BOX;
446 bool dialogs_iconify_with_main = false;
448 bool display_graphics = true;
450 bool show_banner = true;
458 PreviewStatus preview = PREVIEW_OFF;
460 bool preview_hashed_labels = false;
462 double preview_scale_factor = 1.0;
464 std::string user_name; // set in constructor
466 std::string user_email; // set in constructor (empty for now)
468 std::string user_initials;
470 std::string icon_set;
471 /// whether to use the icons from the theme
472 bool use_system_theme_icons = false;
473 /// True if the TeX engine cannot handle posix paths
474 bool windows_style_tex_paths = false;
475 /// True if the TeX engine can handle file names containing spaces
476 bool tex_allows_spaces = false;
477 /** Prepend paths to the PATH environment variable.
478 * The string is input, stored and output in native format.
480 std::string path_prefix;
481 /** Prepend paths to the TEXINPUTS environment variable.
482 * The string is input, stored and output in native format.
483 * A '.' here stands for the current document directory.
485 std::string texinputs_prefix = ".";
486 /// Use the cache for file converters?
487 bool use_converter_cache = true;
488 /// Forbid use of external converters with 'needauth' option
489 bool use_converter_needauth_forbidden = true;
490 /// Ask user before calling external converters with 'needauth' option
491 bool use_converter_needauth = true;
492 /// The maximum age of cache files in seconds
493 unsigned int converter_cache_maxage = 6 * 30 * 24 * 3600; // 6 months;
494 /// Sort layouts alphabetically
495 bool sort_layouts = false;
496 /// Group layout by their category
497 bool group_layouts = true;
498 /// Toggle toolbars in fullscreen mode?
499 bool full_screen_toolbars = true;
500 /// Toggle scrollbar in fullscreen mode?
501 bool full_screen_scrollbar = true;
502 /// Toggle tabbar in fullscreen mode?
503 bool full_screen_tabbar = true;
504 /// Toggle menubar in fullscreen mode?
505 bool full_screen_menubar = true;
506 /// Toggle statusbar in fullscreen mode?
507 bool full_screen_statusbar = true;
508 /// Limit the text width?
509 bool full_screen_limit = false;
510 /// Width of limited screen (in pixels) in fullscreen mode
511 int full_screen_width = 700;
513 bool completion_cursor_text = true;
515 double completion_inline_delay = 0.2;
517 bool completion_inline_math = true;
519 bool completion_inline_text = false;
521 int completion_inline_dots = -1;
523 double completion_popup_delay = 2.0;
525 bool completion_popup_math = true;
527 bool completion_popup_text = false;
529 bool completion_popup_after_complete = true;
531 bool autocorrection_math = false;
533 bool open_buffers_in_tabs = true;
535 bool single_close_tab_button = false;
537 bool single_instance = true;
539 std::string forward_search_dvi;
541 std::string forward_search_pdf;
543 int export_overwrite = NO_FILES;
544 /// Default decimal point when aligning table columns on decimal
545 std::string default_decimal_sep = "locale";
547 Length::UNIT default_length_unit = Length::CM;
549 enum ScrollWheelZoom {
550 SCROLL_WHEEL_ZOOM_OFF,
551 SCROLL_WHEEL_ZOOM_CTRL,
552 SCROLL_WHEEL_ZOOM_SHIFT,
553 SCROLL_WHEEL_ZOOM_ALT
556 ScrollWheelZoom scroll_wheel_zoom = SCROLL_WHEEL_ZOOM_CTRL;
558 int cursor_width = 1;
559 /// One of: yes, no, ask
560 std::string close_buffer_with_last_view = "yes";
564 void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new);
569 extern LyXRC system_lyxrc;
571 // used by at least frontends/qt/GuiPref.cpp
572 const long maxlastfiles = 50;