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.
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_COMPLETION_CURSOR_TEXT,
57 RC_COMPLETION_INLINE_DELAY,
58 RC_COMPLETION_INLINE_MATH,
59 RC_COMPLETION_INLINE_TEXT,
60 RC_COMPLETION_INLINE_DOTS,
61 RC_COMPLETION_MINLENGTH,
62 RC_COMPLETION_POPUP_DELAY,
63 RC_COMPLETION_POPUP_MATH,
64 RC_COMPLETION_POPUP_TEXT,
65 RC_COMPLETION_POPUP_AFTER_COMPLETE,
67 RC_CONVERTER_CACHE_MAXAGE,
69 RC_CURSOR_FOLLOWS_SCROLLBAR,
71 RC_DEFAULT_DECIMAL_SEP,
72 RC_DEFAULT_LENGTH_UNIT,
73 RC_DEFAULT_OTF_VIEW_FORMAT,
74 RC_DEFAULT_PLATEX_VIEW_FORMAT,
75 RC_DEFAULT_VIEW_FORMAT,
77 RC_DIALOGS_ICONIFY_WITH_MAIN,
80 RC_EDITOR_ALTERNATIVES,
85 RC_FORWARD_SEARCH_DVI,
86 RC_FORWARD_SEARCH_PDF,
88 RC_FULL_SCREEN_SCROLLBAR,
89 RC_FULL_SCREEN_STATUSBAR,
90 RC_FULL_SCREEN_TABBAR,
91 RC_FULL_SCREEN_MENUBAR,
92 RC_FULL_SCREEN_TOOLBARS,
99 RC_INDEX_ALTERNATIVES,
102 RC_JBIBTEX_ALTERNATIVES,
108 RC_LANGUAGE_AUTO_BEGIN,
109 RC_LANGUAGE_AUTO_END,
110 RC_LANGUAGE_COMMAND_BEGIN,
111 RC_LANGUAGE_COMMAND_END,
112 RC_LANGUAGE_COMMAND_LOCAL,
113 RC_LANGUAGE_GLOBAL_OPTIONS,
114 RC_LANGUAGE_CUSTOM_PACKAGE,
115 RC_LANGUAGE_PACKAGE_SELECTION,
119 RC_MAC_DONTSWAP_CTRL_META,
120 RC_MAC_LIKE_CURSOR_MOVEMENT,
122 RC_MARK_FOREIGN_LANGUAGE,
123 RC_MOUSE_WHEEL_SPEED,
124 RC_MOUSE_MIDDLEBUTTON_PASTE,
127 RC_OPEN_BUFFERS_IN_TABS,
128 RC_PARAGRAPH_MARKERS,
130 RC_PLAINTEXT_LINELEN,
132 RC_PREVIEW_HASHED_LABELS,
133 RC_PREVIEW_SCALE_FACTOR,
134 RC_PRINTLANDSCAPEFLAG,
135 RC_PRINTPAPERDIMENSIONFLAG,
137 RC_PYGMENTIZE_COMMAND,
138 RC_RESPECT_OS_KBD_LANGUAGE,
142 RC_SCREEN_FONT_ROMAN,
143 RC_SCREEN_FONT_ROMAN_FOUNDRY,
145 RC_SCREEN_FONT_SANS_FOUNDRY,
146 RC_SCREEN_FONT_SCALABLE,
147 RC_SCREEN_FONT_SIZES,
148 RC_SCREEN_FONT_TYPEWRITER,
149 RC_SCREEN_FONT_TYPEWRITER_FOUNDRY,
151 RC_SCROLL_BELOW_DOCUMENT,
152 RC_SCROLL_WHEEL_ZOOM,
156 RC_SINGLE_CLOSE_TAB_BUTTON,
159 RC_SPELLCHECK_CONTINUOUSLY,
162 RC_SPLITINDEX_COMMAND,
165 RC_TEX_ALLOWS_SPACES,
166 RC_TEX_EXPECTS_WINDOWS_PATHS,
174 RC_USE_CONVERTER_CACHE,
175 RC_USE_CONVERTER_NEEDAUTH_FORBIDDEN,
176 RC_USE_CONVERTER_NEEDAUTH,
177 RC_USE_NATIVE_FILEDIALOG,
178 RC_USE_SYSTEM_COLORS,
180 RC_USE_SYSTEM_THEME_ICONS,
181 RC_VIEWDVI_PAPEROPTION,
183 RC_VIEWER_ALTERNATIVES,
185 RC_CLOSE_BUFFER_WITH_LAST_VIEW,
190 LyXRC() : user_name(support::user_name()),
191 user_email(support::user_email()) // always empty
194 /// \param check_format: whether to try to convert the file format,
195 /// if it is not current. this should only be true, really, for the
196 /// user's own preferences file.
197 bool read(support::FileName const & filename, bool check_format);
199 bool read(std::istream &);
207 ReturnValues read(Lexer &, bool check_format);
210 typedef std::set<std::string> CommandSet;
211 /// maps a format to a set of commands that can be used to
213 typedef std::map<std::string, CommandSet> Alternatives;
215 void write(support::FileName const & filename,
216 bool ignore_system_lyxrc) const;
217 /// write rc. If a specific tag is given, only output that one.
218 void write(std::ostream & os,
219 bool ignore_system_lyxrc,
220 std::string const & tag = std::string()) const;
224 std::set<std::string> getRCs();
225 // FIXME unused (was used for xforms. Do we still need this?)
226 //static docstring const getDescription(LyXRCTags);
228 std::string bind_file = "cua";
230 std::string def_file = "default";
232 std::string ui_file = "default";
234 std::string print_landscape_flag = "-t landscape";
236 std::string print_paper_flag = "-t";
238 std::string print_paper_dimension_flag = "-T";
239 /// option for telling the dvi viewer about the paper size
240 std::string view_dvi_paper_option;
241 /// default paper size for local xdvi/dvips/ghostview/whatever
242 /// command to run chktex incl. options
243 std::string chktex_command = "chktex -n1 -n3 -n6 -n9 -n22 -n25 -n30 -n38";
244 /// all available commands to run bibtex incl. options
245 CommandSet bibtex_alternatives;
246 /// command to run bibtex incl. options
247 std::string bibtex_command = "automatic";
248 /// command to run japanese bibtex incl. options
249 std::string jbibtex_command;
250 /// all available commands to run japanese bibtex incl. options
251 CommandSet jbibtex_alternatives;
252 /// all available index commands incl. options
253 CommandSet index_alternatives;
254 /// command to run makeindex incl. options or other index programs
255 std::string index_command = "makeindex -c -q";
256 /// command to run japanese index program incl. options
257 std::string jindex_command;
258 /// command to generate multiple indices
259 std::string splitindex_command;
260 /// command to run makeindex incl. options for nomencl
261 std::string nomencl_command = "makeindex -s nomencl.ist";
262 /// command to run the python pygments syntax highlighter
263 std::string pygmentize_command;
265 std::string document_path;
267 std::string example_path;
269 std::string template_path;
271 std::string tempdir_path;
273 std::string thesaurusdir_path;
275 std::string hunspelldir_path;
277 bool auto_region_delete = true;
278 /// enable middle-mouse-button paste
279 bool mouse_middlebutton_paste = true;
281 bool auto_reset_options = false;
282 /// flag telling whether lastfiles should be checked for existance
283 bool check_lastfiles = true;
284 /// maximal number of lastfiles
285 unsigned int num_lastfiles = 20;
286 /// whether or not go to saved position when opening a file
287 bool use_lastfilepos = true;
288 /// load files from last session automatically
289 bool load_session = false;
290 /// do we save new documents as compressed by default
291 bool save_compressed = false;
292 /// whether or not to save the document dir in the file
293 bool save_origin = false;
294 /// shall a backup file be created
295 bool make_backup = true;
296 /// A directory for storing backup files
297 std::string backupdir_path;
298 /// Whether or not save/restore session information
299 /// like windows position and geometry.
300 bool allow_geometry_session = true;
301 /// Scrolling speed of the mouse wheel
302 double mouse_wheel_speed = 1.0;
303 /// Default zoom factor for screen fonts
304 int defaultZoom = 150;
305 /// Actual zoom factor for screen fonts
306 /// (default zoom plus buffer zoom factor)
307 int currentZoom = 150;
308 /// Screen font sizes in points for each font size
309 std::string font_sizes[10] = { "5.0", "7.0", "8.0", "9.0", "10.0",
310 "12.0", "14.4", "17.26", "20.74", "24.88"};
311 /// Allow the use of scalable fonts? Default is yes.
312 bool use_scalable_fonts = true;
314 unsigned int dpi = 75;
316 std::string roman_font_name;
318 std::string sans_font_name;
320 std::string typewriter_font_name;
322 std::string roman_font_foundry;
324 std::string sans_font_foundry;
326 std::string typewriter_font_foundry;
328 unsigned int autosave = 300;
330 unsigned int plaintext_linelen = 65;
331 /// End of paragraph markers?
332 bool paragraph_markers = false;
334 bool use_tooltip = true;
335 /// Use the colors from current system theme?
336 bool use_system_colors = false;
337 /// use native file dialog or our own ?
338 bool use_native_filedialog = true;
339 /// Spellchecker engine: aspell, hunspell, etc
340 std::string spellchecker
341 #if defined(USE_MACOSX_PACKAGING)
343 #elif defined(USE_ENCHANT)
345 #elif defined(USE_ASPELL)
347 #elif defined(USE_HUNSPELL)
352 /// Alternate language for spellchecker
353 std::string spellchecker_alt_lang;
354 /// Escape characters
355 std::string spellchecker_esc_chars;
356 /// Accept compound words in spellchecker?
357 bool spellchecker_accept_compound = false;
358 /// spellcheck continuously?
359 bool spellcheck_continuously = false;
360 /// spellcheck notes and comments?
361 bool spellcheck_notes = true;
362 /// minimum length of words to complete
363 unsigned int completion_minlength = 6;
365 bool use_kbmap = false;
367 std::string primary_kbmap;
369 std::string secondary_kbmap;
371 std::string lyxpipes;
373 std::string language_custom_package = "\\usepackage{babel}";
375 bool language_auto_begin = true;
377 bool language_auto_end = true;
379 std::string language_command_begin = "\\selectlanguage{$$lang}";
381 std::string language_command_end;
383 std::string language_command_local = "\\foreignlanguage{$$lang}{";
385 bool language_global_options = true;
387 enum LangPackageSelection {
394 LangPackageSelection language_package_selection = LP_AUTO;
395 /// bidi cursor movement: true = visual, false = logical
396 bool visual_cursor = false;
398 bool auto_number = true;
400 bool mark_foreign_language = true;
402 std::string gui_language = "auto";
404 bool respect_os_kbd_language = false;
406 std::string default_otf_view_format = "pdf4";
408 std::string default_platex_view_format = "pdf3";
410 std::string default_view_format = "pdf2";
411 /// all available viewers
412 Alternatives viewer_alternatives;
413 /// all available editors
414 Alternatives editor_alternatives;
416 bool mac_dontswap_ctrl_meta = false;
418 bool mac_like_cursor_movement = false;
420 bool cursor_follows_scrollbar = false;
422 bool scroll_below_document = false;
424 enum MacroEditStyle {
425 MACRO_EDIT_INLINE_BOX = 0,
430 MacroEditStyle macro_edit_style = MACRO_EDIT_INLINE_BOX;
432 bool dialogs_iconify_with_main = false;
434 bool display_graphics = true;
436 bool show_banner = true;
444 PreviewStatus preview = PREVIEW_OFF;
446 bool preview_hashed_labels = false;
448 double preview_scale_factor = 1.0;
450 std::string user_name; // set in constructor
452 std::string user_email; // set in constructor (empty for now)
454 std::string user_initials;
456 std::string icon_set;
457 /// whether to use the icons from the theme
458 bool use_system_theme_icons = false;
459 /// True if the TeX engine cannot handle posix paths
460 bool windows_style_tex_paths = false;
461 /// True if the TeX engine can handle file names containing spaces
462 bool tex_allows_spaces = false;
463 /** Prepend paths to the PATH environment variable.
464 * The string is input, stored and output in native format.
466 std::string path_prefix;
467 /** Prepend paths to the TEXINPUTS environment variable.
468 * The string is input, stored and output in native format.
469 * A '.' here stands for the current document directory.
471 std::string texinputs_prefix = ".";
472 /// Use the cache for file converters?
473 bool use_converter_cache = true;
474 /// Forbid use of external converters with 'needauth' option
475 bool use_converter_needauth_forbidden = true;
476 /// Ask user before calling external converters with 'needauth' option
477 bool use_converter_needauth = true;
478 /// The maximum age of cache files in seconds
479 unsigned int converter_cache_maxage = 6 * 30 * 24 * 3600; // 6 months;
480 /// Sort layouts alphabetically
481 bool sort_layouts = false;
482 /// Group layout by their category
483 bool group_layouts = true;
484 /// Toggle toolbars in fullscreen mode?
485 bool full_screen_toolbars = true;
486 /// Toggle scrollbar in fullscreen mode?
487 bool full_screen_scrollbar = true;
488 /// Toggle tabbar in fullscreen mode?
489 bool full_screen_tabbar = true;
490 /// Toggle menubar in fullscreen mode?
491 bool full_screen_menubar = true;
492 /// Toggle statusbar in fullscreen mode?
493 bool full_screen_statusbar = true;
494 /// Limit the text width?
495 bool full_screen_limit = false;
496 /// Width of limited screen (in pixels) in fullscreen mode
497 int full_screen_width = 700;
499 bool completion_cursor_text = true;
501 double completion_inline_delay = 0.2;
503 bool completion_inline_math = true;
505 bool completion_inline_text = false;
507 int completion_inline_dots = -1;
509 double completion_popup_delay = 2.0;
511 bool completion_popup_math = true;
513 bool completion_popup_text = false;
515 bool completion_popup_after_complete = true;
517 bool autocorrection_math = false;
519 bool open_buffers_in_tabs = true;
521 bool single_close_tab_button = false;
523 bool single_instance = true;
525 std::string forward_search_dvi;
527 std::string forward_search_pdf;
529 int export_overwrite = NO_FILES;
530 /// Default decimal point when aligning table columns on decimal
531 std::string default_decimal_sep = "locale";
533 Length::UNIT default_length_unit = Length::CM;
535 enum ScrollWheelZoom {
536 SCROLL_WHEEL_ZOOM_OFF,
537 SCROLL_WHEEL_ZOOM_CTRL,
538 SCROLL_WHEEL_ZOOM_SHIFT,
539 SCROLL_WHEEL_ZOOM_ALT
542 ScrollWheelZoom scroll_wheel_zoom = SCROLL_WHEEL_ZOOM_CTRL;
544 int cursor_width = 1;
545 /// One of: yes, no, ask
546 std::string close_buffer_with_last_view = "yes";
550 void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new);
555 extern LyXRC system_lyxrc;
557 // used by at least frontends/qt/GuiPref.cpp
558 const long maxlastfiles = 50;