3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
6 * \author Lars Gullik Bjønnes
7 * \author Jean-Marc Lasgouttes
8 * \author Angus Leeming
10 * \author André Pönitz
14 * Full author contact details are available in file CREDITS.
21 #include "BufferList.h"
23 #include "Converter.h"
24 #include "FontEnums.h"
27 #include "FuncRequest.h"
30 #include "SpellChecker.h"
33 #include "support/convert.h"
34 #include "support/debug.h"
35 #include "support/environment.h"
36 #include "support/FileName.h"
37 #include "support/filetools.h"
38 #include "support/Lexer.h"
39 #include "support/lstrings.h"
40 #include "support/os.h"
41 #include "support/Package.h"
42 #include "support/TempFile.h"
44 #ifdef USE_MACOSX_PACKAGING
45 #include "support/AppleSupport.h"
53 using namespace lyx::support;
57 namespace os = support::os;
61 // The format should also be updated in configure.py, and conversion code
62 // should be added to prefs2prefs_prefs.py.
63 static unsigned int const LYXRC_FILEFORMAT = 38; // chillenb: screen_width and screen_limit
64 // when adding something to this array keep it sorted!
65 LexerKeyword lyxrcTags[] = {
66 { "\\accept_compound", LyXRC::RC_ACCEPT_COMPOUND },
67 { "\\allow_geometry_session", LyXRC::RC_GEOMETRY_SESSION },
68 { "\\alternate_language", LyXRC::RC_ALT_LANG },
69 { "\\auto_number", LyXRC::RC_AUTO_NUMBER },
70 { "\\auto_region_delete", LyXRC::RC_AUTOREGIONDELETE },
71 { "\\auto_reset_options", LyXRC::RC_AUTORESET_OPTIONS },
72 { "\\autocorrection_math", LyXRC::RC_AUTOCORRECTION_MATH },
73 { "\\autosave", LyXRC::RC_AUTOSAVE },
74 { "\\backupdir_path", LyXRC::RC_BACKUPDIR_PATH },
75 { "\\bibtex_alternatives", LyXRC::RC_BIBTEX_ALTERNATIVES },
76 { "\\bibtex_command", LyXRC::RC_BIBTEX_COMMAND },
77 { "\\bind_file", LyXRC::RC_BINDFILE },
78 { "\\check_lastfiles", LyXRC::RC_CHECKLASTFILES },
79 { "\\chktex_command", LyXRC::RC_CHKTEX_COMMAND },
80 { "\\citation_search", LyXRC::RC_CITATION_SEARCH },
81 { "\\citation_search_pattern", LyXRC::RC_CITATION_SEARCH_PATTERN },
82 { "\\citation_search_view", LyXRC::RC_CITATION_SEARCH_VIEW },
83 { "\\close_buffer_with_last_view", LyXRC::RC_CLOSE_BUFFER_WITH_LAST_VIEW },
84 { "\\completion_cursor_text", LyXRC::RC_COMPLETION_CURSOR_TEXT },
85 { "\\completion_inline_delay", LyXRC::RC_COMPLETION_INLINE_DELAY },
86 { "\\completion_inline_dots", LyXRC::RC_COMPLETION_INLINE_DOTS },
87 { "\\completion_inline_math", LyXRC::RC_COMPLETION_INLINE_MATH },
88 { "\\completion_inline_text", LyXRC::RC_COMPLETION_INLINE_TEXT },
89 { "\\completion_minlength", LyXRC::RC_COMPLETION_MINLENGTH },
90 { "\\completion_popup_after_complete", LyXRC::RC_COMPLETION_POPUP_AFTER_COMPLETE },
91 { "\\completion_popup_delay", LyXRC::RC_COMPLETION_POPUP_DELAY },
92 { "\\completion_popup_math", LyXRC::RC_COMPLETION_POPUP_MATH },
93 { "\\completion_popup_text", LyXRC::RC_COMPLETION_POPUP_TEXT },
94 { "\\converter", LyXRC::RC_CONVERTER },
95 { "\\converter_cache_maxage", LyXRC::RC_CONVERTER_CACHE_MAXAGE },
96 { "\\copier", LyXRC::RC_COPIER },
97 { "\\ct_additions_underlined", LyXRC::RC_CT_ADDITIONS_UNDERLINED },
98 { "\\ct_markup_copied", LyXRC::RC_CT_MARKUP_COPIED },
99 { "\\cursor_follows_scrollbar", LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR },
100 { "\\cursor_width", LyXRC::RC_CURSOR_WIDTH },
101 { "\\def_file", LyXRC::RC_DEFFILE },
102 { "\\default_decimal_point", LyXRC::RC_DEFAULT_DECIMAL_SEP },
103 { "\\default_length_unit", LyXRC::RC_DEFAULT_LENGTH_UNIT },
104 { "\\default_otf_view_format", LyXRC::RC_DEFAULT_OTF_VIEW_FORMAT },
105 { "\\default_platex_view_format", LyXRC::RC_DEFAULT_PLATEX_VIEW_FORMAT },
106 { "\\default_view_format", LyXRC::RC_DEFAULT_VIEW_FORMAT },
107 { "\\dialogs_iconify_with_main", LyXRC::RC_DIALOGS_ICONIFY_WITH_MAIN },
108 { "\\display_graphics", LyXRC::RC_DISPLAY_GRAPHICS },
109 { "\\document_path", LyXRC::RC_DOCUMENTPATH },
110 { "\\draw_strategy", LyXRC::RC_DRAW_STRATEGY },
111 { "\\editor_alternatives", LyXRC::RC_EDITOR_ALTERNATIVES },
112 { "\\escape_chars", LyXRC::RC_ESC_CHARS },
113 { "\\example_path", LyXRC::RC_EXAMPLEPATH },
114 { "\\experimental:bookmarks_visibility", LyXRC::RC_BOOKMARKS_VISIBILITY },
115 { "\\export_overwrite", LyXRC::RC_EXPORT_OVERWRITE },
116 { "\\format", LyXRC::RC_FILEFORMAT },
117 { "\\forward_search_dvi", LyXRC::RC_FORWARD_SEARCH_DVI },
118 { "\\forward_search_pdf", LyXRC::RC_FORWARD_SEARCH_PDF },
119 { "\\fullscreen_menubar", LyXRC::RC_FULL_SCREEN_MENUBAR },
120 { "\\fullscreen_scrollbar", LyXRC::RC_FULL_SCREEN_SCROLLBAR },
121 { "\\fullscreen_statusbar", LyXRC::RC_FULL_SCREEN_STATUSBAR },
122 { "\\fullscreen_tabbar", LyXRC::RC_FULL_SCREEN_TABBAR },
123 { "\\fullscreen_toolbars", LyXRC::RC_FULL_SCREEN_TOOLBARS },
124 { "\\group_layouts", LyXRC::RC_GROUP_LAYOUTS },
125 { "\\gui_language", LyXRC::RC_GUI_LANGUAGE },
126 { "\\hunspelldir_path", LyXRC::RC_HUNSPELLDIR_PATH },
127 { "\\icon_set", LyXRC::RC_ICON_SET },
128 { "\\index_alternatives", LyXRC::RC_INDEX_ALTERNATIVES },
129 { "\\index_command", LyXRC::RC_INDEX_COMMAND },
130 { "\\input", LyXRC::RC_INPUT },
131 { "\\jbibtex_alternatives", LyXRC::RC_JBIBTEX_ALTERNATIVES },
132 { "\\jbibtex_command", LyXRC::RC_JBIBTEX_COMMAND },
133 { "\\jindex_command", LyXRC::RC_JINDEX_COMMAND },
134 { "\\kbmap", LyXRC::RC_KBMAP },
135 { "\\kbmap_primary", LyXRC::RC_KBMAP_PRIMARY },
136 { "\\kbmap_secondary", LyXRC::RC_KBMAP_SECONDARY },
137 { "\\language_auto_begin", LyXRC::RC_LANGUAGE_AUTO_BEGIN },
138 { "\\language_auto_end", LyXRC::RC_LANGUAGE_AUTO_END },
139 { "\\language_command_begin", LyXRC::RC_LANGUAGE_COMMAND_BEGIN },
140 { "\\language_command_end", LyXRC::RC_LANGUAGE_COMMAND_END },
141 { "\\language_command_local", LyXRC::RC_LANGUAGE_COMMAND_LOCAL },
142 { "\\language_custom_package", LyXRC::RC_LANGUAGE_CUSTOM_PACKAGE },
143 { "\\language_global_options", LyXRC::RC_LANGUAGE_GLOBAL_OPTIONS },
144 { "\\language_package_selection", LyXRC::RC_LANGUAGE_PACKAGE_SELECTION },
145 { "\\load_session", LyXRC::RC_LOADSESSION },
146 { "\\mac_dontswap_ctrl_meta", LyXRC::RC_MAC_DONTSWAP_CTRL_META },
147 { "\\mac_like_cursor_movement", LyXRC::RC_MAC_LIKE_CURSOR_MOVEMENT },
148 { "\\macro_edit_style", LyXRC::RC_MACRO_EDIT_STYLE },
149 { "\\make_backup", LyXRC::RC_MAKE_BACKUP },
150 { "\\mark_foreign_language", LyXRC::RC_MARK_FOREIGN_LANGUAGE },
151 { "\\mouse_middlebutton_paste", LyXRC::RC_MOUSE_MIDDLEBUTTON_PASTE },
152 { "\\mouse_wheel_speed", LyXRC::RC_MOUSE_WHEEL_SPEED },
153 { "\\nomencl_command", LyXRC::RC_NOMENCL_COMMAND },
154 { "\\num_lastfiles", LyXRC::RC_NUMLASTFILES },
155 { "\\open_buffers_in_tabs", LyXRC::RC_OPEN_BUFFERS_IN_TABS },
156 { "\\paragraph_markers", LyXRC::RC_PARAGRAPH_MARKERS },
157 { "\\path_prefix", LyXRC::RC_PATH_PREFIX },
158 { "\\plaintext_linelen", LyXRC::RC_PLAINTEXT_LINELEN },
159 { "\\preview", LyXRC::RC_PREVIEW },
160 { "\\preview_hashed_labels", LyXRC::RC_PREVIEW_HASHED_LABELS },
161 { "\\preview_scale_factor", LyXRC::RC_PREVIEW_SCALE_FACTOR },
162 { "\\print_landscape_flag", LyXRC::RC_PRINTLANDSCAPEFLAG },
163 { "\\print_paper_dimension_flag", LyXRC::RC_PRINTPAPERDIMENSIONFLAG },
164 { "\\print_paper_flag", LyXRC::RC_PRINTPAPERFLAG },
165 { "\\pygmentize_command", LyXRC::RC_PYGMENTIZE_COMMAND },
166 { "\\respect_os_kbd_language", LyXRC::RC_RESPECT_OS_KBD_LANGUAGE },
167 { "\\save_compressed", LyXRC::RC_SAVE_COMPRESSED },
168 { "\\save_origin", LyXRC::RC_SAVE_ORIGIN },
169 { "\\screen_dpi", LyXRC::RC_SCREEN_DPI },
170 { "\\screen_font_roman", LyXRC::RC_SCREEN_FONT_ROMAN },
171 { "\\screen_font_roman_foundry", LyXRC::RC_SCREEN_FONT_ROMAN_FOUNDRY },
172 { "\\screen_font_sans", LyXRC::RC_SCREEN_FONT_SANS },
173 { "\\screen_font_sans_foundry", LyXRC::RC_SCREEN_FONT_SANS_FOUNDRY },
174 { "\\screen_font_scalable", LyXRC::RC_SCREEN_FONT_SCALABLE },
175 { "\\screen_font_sizes", LyXRC::RC_SCREEN_FONT_SIZES },
176 { "\\screen_font_typewriter", LyXRC::RC_SCREEN_FONT_TYPEWRITER },
177 { "\\screen_font_typewriter_foundry", LyXRC::RC_SCREEN_FONT_TYPEWRITER_FOUNDRY },
178 { "\\screen_limit", LyXRC::RC_SCREEN_LIMIT },
179 { "\\screen_width", LyXRC::RC_SCREEN_WIDTH },
180 { "\\screen_zoom", LyXRC::RC_SCREEN_ZOOM },
181 { "\\scroll_below_document", LyXRC::RC_SCROLL_BELOW_DOCUMENT },
182 { "\\scroll_wheel_zoom", LyXRC::RC_SCROLL_WHEEL_ZOOM },
183 { "\\serverpipe", LyXRC::RC_SERVERPIPE },
184 { "\\set_color", LyXRC::RC_SET_COLOR },
185 { "\\show_banner", LyXRC::RC_SHOW_BANNER },
186 { "\\single_close_tab_button", LyXRC::RC_SINGLE_CLOSE_TAB_BUTTON },
187 { "\\single_instance", LyXRC::RC_SINGLE_INSTANCE },
188 { "\\sort_layouts", LyXRC::RC_SORT_LAYOUTS },
189 { "\\spellcheck_continuously", LyXRC::RC_SPELLCHECK_CONTINUOUSLY },
190 { "\\spellcheck_notes", LyXRC::RC_SPELLCHECK_NOTES },
191 { "\\spellchecker", LyXRC::RC_SPELLCHECKER },
192 { "\\splitindex_command", LyXRC::RC_SPLITINDEX_COMMAND },
193 { "\\tempdir_path", LyXRC::RC_TEMPDIRPATH },
194 { "\\template_path", LyXRC::RC_TEMPLATEPATH },
195 { "\\tex_allows_spaces", LyXRC::RC_TEX_ALLOWS_SPACES },
196 { "\\tex_expects_windows_paths", LyXRC::RC_TEX_EXPECTS_WINDOWS_PATHS },
197 { "\\texinputs_prefix", LyXRC::RC_TEXINPUTS_PREFIX },
198 { "\\thesaurusdir_path", LyXRC::RC_THESAURUSDIRPATH },
199 { "\\ui_file", LyXRC::RC_UIFILE },
200 { "\\ui_style", LyXRC::RC_UI_STYLE },
201 { "\\use_converter_cache", LyXRC::RC_USE_CONVERTER_CACHE },
202 { "\\use_converter_needauth", LyXRC::RC_USE_CONVERTER_NEEDAUTH },
203 { "\\use_converter_needauth_forbidden", LyXRC::RC_USE_CONVERTER_NEEDAUTH_FORBIDDEN },
204 { "\\use_lastfilepos", LyXRC::RC_USELASTFILEPOS },
205 { "\\use_native_filedialog", LyXRC::RC_USE_NATIVE_FILEDIALOG },
206 // compatibility with versions older than 1.4.0 only
207 { "\\use_system_colors", LyXRC::RC_USE_SYSTEM_COLORS },
208 { "\\use_system_theme_icons", LyXRC::RC_USE_SYSTEM_THEME_ICONS },
209 { "\\use_tooltip", LyXRC::RC_USE_TOOLTIP },
210 { "\\user_email", LyXRC::RC_USER_EMAIL },
211 { "\\user_initials", LyXRC::RC_USER_INITIALS },
212 { "\\user_name", LyXRC::RC_USER_NAME },
213 { "\\view_dvi_paper_option", LyXRC::RC_VIEWDVI_PAPEROPTION },
214 // compatibility with versions older than 1.4.0 only
215 { "\\viewer", LyXRC::RC_VIEWER},
216 { "\\viewer_alternatives", LyXRC::RC_VIEWER_ALTERNATIVES },
217 { "\\visual_cursor", LyXRC::RC_VISUAL_CURSOR },
218 { "format", LyXRC::RC_LYXRCFORMAT }
221 const int lyxrcCount = sizeof(lyxrcTags) / sizeof(lyxrcTags[0]);
224 void oldFontFormat(string & family, string & foundry)
226 if (family.empty() || family[0] != '-')
228 foundry = token(family, '-', 1);
229 family = token(family, '-', 2);
237 bool LyXRC::read(FileName const & filename, bool check_format)
239 Lexer lexrc(lyxrcTags);
240 lexrc.setFile(filename);
241 LYXERR(Debug::LYXRC, "Reading '" << filename << "'...");
242 ReturnValues retval = read(lexrc, check_format);
243 if (!check_format || retval != FormatMismatch)
244 return retval == ReadOK;
246 LYXERR(Debug::FILES, "Converting LyXRC file to " << LYXRC_FILEFORMAT);
247 TempFile tmp("convert_lyxrc");
248 FileName const tempfile = tmp.name();
249 bool const success = prefs2prefs(filename, tempfile, false);
251 LYXERR0 ("Unable to convert " << filename.absFileName() <<
252 " to format " << LYXRC_FILEFORMAT);
255 // Keep this in the else branch, such that lexrc2 goes out
256 // of scope and releases the lock on tempfile before we
257 // attempt to remove it. This matters on Windows.
258 Lexer lexrc2(lyxrcTags);
259 lexrc2.setFile(tempfile);
260 LYXERR(Debug::LYXRC, "Reading '" << tempfile << "'...");
261 retval = read(lexrc2, check_format);
262 if (retval == FormatMismatch)
263 LYXERR0("Conversion failed for " << filename.absFileName());
265 return retval == ReadOK;
269 // don't need to worry about conversion, because this is always
270 // from an internal source
271 bool LyXRC::read(istream & is)
273 Lexer lexrc(lyxrcTags);
275 LYXERR(Debug::LYXRC, "Reading istream...");
276 return read(lexrc, false) == ReadOK;
280 LyXRC::ReturnValues LyXRC::read(Lexer & lexrc, bool check_format)
282 if (lyxerr.debugging(Debug::PARSER))
283 lexrc.printTable(lyxerr);
288 // format prior to 2.0 and introduction of format tag
289 unsigned int rc_format = 0;
291 while (lexrc.isOK()) {
292 // By using two switches we take advantage of the compiler
293 // telling us if we have missed a LyXRCTags element in
294 // the second switch.
295 // Note that this also shows a problem with Lexer since it
296 // helps us avoid taking advantage of the strictness of the
299 int le = lexrc.lex();
301 case Lexer::LEX_UNDEF:
302 lexrc.printError("Unknown tag `$$Token'");
304 case Lexer::LEX_FEOF:
309 switch (static_cast<LyXRCTags>(le)) {
312 rc_format = lexrc.getInteger();
314 case RC_INPUT: // Include file
317 libFileSearch(string(),
319 if (!read(tmp, check_format)) {
321 "Error reading included file: " + tmp.absFileName());
327 bind_file = os::internal_path(lexrc.getString());
332 def_file = os::internal_path(lexrc.getString());
337 ui_file = os::internal_path(lexrc.getString());
340 case RC_AUTORESET_OPTIONS:
341 lexrc >> auto_reset_options;
344 case RC_DISPLAY_GRAPHICS:
346 display_graphics = lexrc.getString() == "true";
349 case RC_TEX_EXPECTS_WINDOWS_PATHS:
350 lexrc >> windows_style_tex_paths;
353 case RC_TEX_ALLOWS_SPACES:
354 lexrc >> tex_allows_spaces;
357 case RC_TEXINPUTS_PREFIX:
358 lexrc >> texinputs_prefix;
365 case RC_KBMAP_PRIMARY:
367 string const kmap(os::internal_path(lexrc.getString()));
368 if (!libFileSearch("kbd", kmap, "kmap").empty()
370 primary_kbmap = kmap;
372 lexrc.printError("LyX: Keymap `$$Token' not found");
377 case RC_KBMAP_SECONDARY:
379 string const kmap(os::internal_path(lexrc.getString()));
380 if (!libFileSearch("kbd", kmap, "kmap").empty()
382 secondary_kbmap = kmap;
384 lexrc.printError("LyX: Keymap `$$Token' not found");
389 case RC_PRINTLANDSCAPEFLAG:
390 lexrc >> print_landscape_flag;
393 case RC_PRINTPAPERDIMENSIONFLAG:
394 lexrc >> print_paper_dimension_flag;
397 case RC_PRINTPAPERFLAG:
398 lexrc >> print_paper_flag;
401 case RC_PYGMENTIZE_COMMAND:
402 if (lexrc.next(true)) {
403 pygmentize_command = lexrc.getString();
407 case RC_VIEWDVI_PAPEROPTION:
409 view_dvi_paper_option = lexrc.getString();
411 view_dvi_paper_option.erase();
414 case RC_CHKTEX_COMMAND:
415 if (lexrc.next(true)) {
416 chktex_command = lexrc.getString();
420 case RC_BIBTEX_ALTERNATIVES:
421 if (lexrc.next(true)) {
422 bibtex_alternatives.insert(lexrc.getString());
426 case RC_BIBTEX_COMMAND:
427 if (lexrc.next(true)) {
428 bibtex_command = lexrc.getString();
432 case RC_JBIBTEX_COMMAND:
433 if (lexrc.next(true)) {
434 jbibtex_command = lexrc.getString();
438 case RC_JBIBTEX_ALTERNATIVES:
439 if (lexrc.next(true)) {
440 jbibtex_alternatives.insert(lexrc.getString());
444 case RC_INDEX_ALTERNATIVES:
445 if (lexrc.next(true)) {
446 index_alternatives.insert(lexrc.getString());
450 case RC_INDEX_COMMAND:
451 if (lexrc.next(true)) {
452 index_command = lexrc.getString();
456 case RC_JINDEX_COMMAND:
457 if (lexrc.next(true)) {
458 jindex_command = lexrc.getString();
462 case RC_SPLITINDEX_COMMAND:
463 if (lexrc.next(true)) {
464 splitindex_command = lexrc.getString();
468 case RC_NOMENCL_COMMAND:
469 if (lexrc.next(true)) {
470 nomencl_command = lexrc.getString();
479 lexrc >> defaultZoom;
480 if (defaultZoom < 10)
484 case RC_GEOMETRY_SESSION:
485 lexrc >> allow_geometry_session;
488 case RC_SCREEN_FONT_SIZES:
489 lexrc >> font_sizes[TINY_SIZE];
490 lexrc >> font_sizes[SCRIPT_SIZE];
491 lexrc >> font_sizes[FOOTNOTE_SIZE];
492 lexrc >> font_sizes[SMALL_SIZE];
493 lexrc >> font_sizes[NORMAL_SIZE];
494 lexrc >> font_sizes[LARGE_SIZE];
495 lexrc >> font_sizes[LARGER_SIZE];
496 lexrc >> font_sizes[LARGEST_SIZE];
497 lexrc >> font_sizes[HUGE_SIZE];
498 lexrc >> font_sizes[HUGER_SIZE];
501 case RC_SCREEN_FONT_SCALABLE:
502 lexrc >> use_scalable_fonts;
509 case RC_DOCUMENTPATH:
511 document_path = os::internal_path(lexrc.getString());
516 example_path = os::internal_path(lexrc.getString());
519 case RC_TEMPLATEPATH:
521 template_path = os::internal_path(lexrc.getString());
526 tempdir_path = os::internal_path(lexrc.getString());
529 case RC_THESAURUSDIRPATH:
531 thesaurusdir_path = os::internal_path(lexrc.getString());
534 case RC_HUNSPELLDIR_PATH:
536 hunspelldir_path = os::internal_path(lexrc.getString());
539 case RC_USELASTFILEPOS:
540 lexrc >> use_lastfilepos;
544 lexrc >> load_session;
547 case RC_MOUSE_WHEEL_SPEED:
548 lexrc >> mouse_wheel_speed;
551 case RC_COMPLETION_INLINE_DELAY:
552 lexrc >> completion_inline_delay;
555 case RC_COMPLETION_INLINE_MATH:
556 lexrc >> completion_inline_math;
559 case RC_COMPLETION_INLINE_TEXT:
560 lexrc >> completion_inline_text;
563 case RC_COMPLETION_INLINE_DOTS:
564 lexrc >> completion_inline_dots;
567 case RC_AUTOCORRECTION_MATH:
568 lexrc >> autocorrection_math;
571 case RC_COMPLETION_POPUP_DELAY:
572 lexrc >> completion_popup_delay;
575 case RC_COMPLETION_POPUP_MATH:
576 lexrc >> completion_popup_math;
579 case RC_COMPLETION_POPUP_TEXT:
580 lexrc >> completion_popup_text;
583 case RC_COMPLETION_CURSOR_TEXT:
584 lexrc >> completion_cursor_text;
587 case RC_COMPLETION_POPUP_AFTER_COMPLETE:
588 lexrc >> completion_popup_after_complete;
591 case RC_COMPLETION_MINLENGTH:
592 lexrc >> completion_minlength;
595 case RC_NUMLASTFILES:
596 lexrc >> num_lastfiles;
599 case RC_CHECKLASTFILES:
600 lexrc >> check_lastfiles;
611 case RC_USE_SYSTEM_THEME_ICONS:
612 lexrc >> use_system_theme_icons;
615 case RC_SCREEN_FONT_ROMAN:
617 roman_font_name = lexrc.getString();
618 oldFontFormat(roman_font_name,
623 case RC_SCREEN_FONT_SANS:
625 sans_font_name = lexrc.getString();
626 oldFontFormat(sans_font_name, sans_font_foundry);
630 case RC_SCREEN_FONT_TYPEWRITER:
632 typewriter_font_name = lexrc.getString();
633 oldFontFormat(typewriter_font_name,
634 typewriter_font_foundry);
638 case RC_SCREEN_FONT_ROMAN_FOUNDRY:
639 lexrc >> roman_font_foundry;
642 case RC_SCREEN_FONT_SANS_FOUNDRY:
643 lexrc >> sans_font_foundry;
646 case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
647 lexrc >> typewriter_font_foundry;
652 lexrc.printError("Missing color tag.");
655 string const lyx_name = lexrc.getString();
658 lexrc.printError("Missing color name for color: `$$Token'");
661 string const x11_name = lexrc.getString();
663 string x11_darkname = x11_name;
665 x11_darkname = lexrc.getString();
667 ColorCode const col =
668 lcolor.getFromLyXName(lyx_name);
669 if (col == Color_none ||
670 col == Color_inherit ||
674 if (!lcolor.setColor(col, x11_name, x11_darkname))
675 LYXERR0("Bad lyxrc set_color for " << lyx_name);
676 LYXERR(Debug::LYXRC, "Set " << lyx_name << "(" << col << ") to "
677 << x11_name << " and " << x11_darkname);
681 case RC_AUTOREGIONDELETE:
682 // Auto region delete defaults to true
683 lexrc >> auto_region_delete;
688 string userdir = package().user_support().absFileName();
689 if (userdir.back() == '/')
691 lyxpipes = subst(os::internal_path(lexrc.getString()), "$$UserDir",
696 case RC_CITATION_SEARCH:
697 lexrc >> citation_search;
700 case RC_CITATION_SEARCH_PATTERN:
702 citation_search_pattern = lexrc.getString();
705 case RC_CITATION_SEARCH_VIEW:
707 citation_search_view = lexrc.getString();
710 case RC_CT_ADDITIONS_UNDERLINED:
711 lexrc >> ct_additions_underlined;
714 case RC_CT_MARKUP_COPIED:
715 lexrc >> ct_markup_copied;
718 case RC_CURSOR_FOLLOWS_SCROLLBAR:
719 lexrc >> cursor_follows_scrollbar;
722 case RC_CURSOR_WIDTH:
723 lexrc >> cursor_width;
726 case RC_SCROLL_BELOW_DOCUMENT:
727 lexrc >> scroll_below_document;
730 case RC_PARAGRAPH_MARKERS:
731 lexrc >> paragraph_markers;
734 case RC_MAC_DONTSWAP_CTRL_META:
735 lexrc >> mac_dontswap_ctrl_meta;
738 case RC_MAC_LIKE_CURSOR_MOVEMENT:
739 lexrc >> mac_like_cursor_movement;
742 case RC_MACRO_EDIT_STYLE:
744 switch (lexrc.getInteger()) {
745 case 0: macro_edit_style = MACRO_EDIT_INLINE_BOX; break;
746 case 1: macro_edit_style = MACRO_EDIT_INLINE; break;
747 case 2: macro_edit_style = MACRO_EDIT_LIST; break;
752 case RC_DIALOGS_ICONIFY_WITH_MAIN:
753 lexrc >> dialogs_iconify_with_main;
756 case RC_PLAINTEXT_LINELEN:
757 lexrc >> plaintext_linelen;
759 // Spellchecker settings:
760 case RC_ACCEPT_COMPOUND:
761 lexrc >> spellchecker_accept_compound;
763 case RC_USE_NATIVE_FILEDIALOG:
764 lexrc >> use_native_filedialog;
766 case RC_USE_SYSTEM_COLORS:
767 lexrc >> use_system_colors;
770 lexrc >> use_tooltip;
772 case RC_SPELLCHECKER:
773 lexrc >> spellchecker;
776 lexrc >> spellchecker_alt_lang;
779 lexrc >> spellchecker_esc_chars;
781 case RC_SPELLCHECK_CONTINUOUSLY:
782 lexrc >> spellcheck_continuously;
784 case RC_SPELLCHECK_NOTES:
785 lexrc >> spellcheck_notes;
788 lexrc >> make_backup;
790 case RC_SAVE_COMPRESSED:
791 lexrc >> save_compressed;
794 lexrc >> save_origin;
796 case RC_BACKUPDIR_PATH:
798 backupdir_path = os::internal_path(lexrc.getString());
800 case RC_DEFAULT_DECIMAL_SEP:
801 lexrc >> default_decimal_sep;
803 case RC_DEFAULT_LENGTH_UNIT:
805 default_length_unit = (Length::UNIT) lexrc.getInteger();
807 case RC_LANGUAGE_CUSTOM_PACKAGE:
808 lexrc >> language_custom_package;
810 case RC_LANGUAGE_AUTO_BEGIN:
811 lexrc >> language_auto_begin;
813 case RC_LANGUAGE_AUTO_END:
814 lexrc >> language_auto_end;
816 case RC_LANGUAGE_GLOBAL_OPTIONS:
817 lexrc >> language_global_options;
819 case RC_LANGUAGE_PACKAGE_SELECTION:
821 switch (lexrc.getInteger()) {
823 language_package_selection = LP_AUTO;
826 language_package_selection = LP_BABEL;
829 language_package_selection = LP_CUSTOM;
832 language_package_selection = LP_NONE;
837 case RC_LANGUAGE_COMMAND_BEGIN:
838 lexrc >> language_command_begin;
840 case RC_LANGUAGE_COMMAND_END:
841 lexrc >> language_command_end;
843 case RC_LANGUAGE_COMMAND_LOCAL:
844 lexrc >> language_command_local;
846 case RC_RESPECT_OS_KBD_LANGUAGE:
847 lexrc >> respect_os_kbd_language;
849 case RC_VISUAL_CURSOR:
850 lexrc >> visual_cursor;
852 case RC_CLOSE_BUFFER_WITH_LAST_VIEW:
853 lexrc >> close_buffer_with_last_view;
856 lexrc >> auto_number;
858 case RC_MARK_FOREIGN_LANGUAGE:
859 lexrc >> mark_foreign_language;
865 fmt = lexrc.getString();
866 if (lexrc.next(true))
867 command = lexrc.getString();
868 setMover(fmt, command);
873 string from, to, command, flags;
875 from = lexrc.getString();
877 to = lexrc.getString();
878 if (lexrc.next(true))
879 command = lexrc.getString();
881 flags = lexrc.getString();
883 theConverters().erase(from, to);
885 theConverters().add(from, to, command, flags);
888 // compatibility with versions older than 1.4.0 only
890 string format, command;
891 lexrc >> format >> command;
892 theFormats().setViewer(format, command);
895 case RC_FILEFORMAT: {
897 string format, extensions, shortcut;
898 docstring prettyname;
899 if (!(lexrc >> format >> extensions))
901 if (ok && lexrc.next(true))
902 prettyname = lexrc.getDocString();
906 if(!(lexrc >> shortcut))
908 string viewer, editor;
909 if (ok && lexrc.next(true))
910 viewer = lexrc.getString();
913 if (ok && lexrc.next(true))
914 editor = lexrc.getString();
918 if (!(lexrc >> flags >> mime))
920 int flgs = Format::none;
921 while (!flags.empty()) {
923 flags = split(flags, flag, ',');
924 if (flag == "document")
925 flgs |= Format::document;
926 else if (flag == "vector")
927 flgs |= Format::vector;
928 else if (flag == "zipped=native")
929 flgs |= Format::zipped_native;
930 else if (flag == "menu=export")
931 flgs |= Format::export_menu;
932 else if (flag == "menu=none")
933 flgs |= Format::no_menu;
935 LYXERR0("Ignoring unknown flag `"
936 << flag << "' for format `"
940 LYXERR0("Syntax error in format " << format);
941 else if (prettyname.empty()) {
942 if (theConverters().formatIsUsed(format))
943 LYXERR0("Can't delete format " << format);
945 theFormats().erase(format);
947 theFormats().add(format, extensions, prettyname,
948 shortcut, viewer, editor, mime, flgs);
952 case RC_VIEWER_ALTERNATIVES: {
953 string format, command;
954 if ((lexrc >> format) && lexrc.next(true)) {
955 command = lexrc.getString();
956 viewer_alternatives[format].insert(command);
960 case RC_EDITOR_ALTERNATIVES: {
961 string format, command;
962 if ((lexrc >> format) && lexrc.next(true)) {
963 command = lexrc.getString();
964 editor_alternatives[format].insert(command);
969 case RC_DEFAULT_OTF_VIEW_FORMAT:
970 lexrc >> default_otf_view_format;
973 case RC_DEFAULT_PLATEX_VIEW_FORMAT:
974 lexrc >> default_platex_view_format;
977 case RC_DEFAULT_VIEW_FORMAT:
978 lexrc >> default_view_format;
981 case RC_GUI_LANGUAGE:
982 lexrc >> gui_language;
986 lexrc >> show_banner;
991 string const tmp = lexrc.getString();
992 if (tmp == "true" || tmp == "on")
993 preview = PREVIEW_ON;
994 else if (tmp == "no_math")
995 preview = PREVIEW_NO_MATH;
997 preview = PREVIEW_OFF;
998 if (tmp != "false" && tmp != "off")
999 LYXERR0("Unrecognized preview status \""
1005 case RC_PREVIEW_HASHED_LABELS:
1006 lexrc >> preview_hashed_labels;
1009 case RC_PREVIEW_SCALE_FACTOR:
1010 lexrc >> preview_scale_factor;
1017 lexrc >> user_email;
1019 case RC_USER_INITIALS:
1020 lexrc >> user_initials;
1023 case RC_PATH_PREFIX:
1024 lexrc >> path_prefix;
1027 case RC_USE_CONVERTER_CACHE:
1028 lexrc >> use_converter_cache;
1030 case RC_USE_CONVERTER_NEEDAUTH_FORBIDDEN:
1031 lexrc >> use_converter_needauth_forbidden;
1033 case RC_USE_CONVERTER_NEEDAUTH:
1034 lexrc >> use_converter_needauth;
1036 case RC_CONVERTER_CACHE_MAXAGE:
1037 lexrc >> converter_cache_maxage;
1040 case RC_SORT_LAYOUTS:
1041 lexrc >> sort_layouts;
1043 case RC_GROUP_LAYOUTS:
1044 lexrc >> group_layouts;
1046 case RC_SCREEN_LIMIT:
1047 lexrc >> screen_limit;
1049 case RC_FULL_SCREEN_TOOLBARS:
1050 lexrc >> full_screen_toolbars;
1052 case RC_FULL_SCREEN_SCROLLBAR:
1053 lexrc >> full_screen_scrollbar;
1055 case RC_FULL_SCREEN_STATUSBAR:
1056 lexrc >> full_screen_statusbar;
1058 case RC_FULL_SCREEN_TABBAR:
1059 lexrc >> full_screen_tabbar;
1061 case RC_FULL_SCREEN_MENUBAR:
1062 lexrc >> full_screen_menubar;
1064 case RC_SCREEN_WIDTH:
1065 lexrc >> screen_width;
1067 case RC_OPEN_BUFFERS_IN_TABS:
1068 lexrc >> open_buffers_in_tabs;
1069 #ifdef USE_MACOSX_PACKAGING
1070 if (appleUserTabbingPreferenceAlways())
1071 open_buffers_in_tabs = true;
1074 case RC_SINGLE_CLOSE_TAB_BUTTON:
1075 lexrc >> single_close_tab_button;
1077 case RC_SINGLE_INSTANCE:
1078 lexrc >> single_instance;
1079 if (run_mode == PREFERRED)
1080 run_mode = single_instance ? USE_REMOTE : NEW_INSTANCE;
1082 case RC_FORWARD_SEARCH_DVI:
1083 if (lexrc.next(true))
1084 forward_search_dvi = lexrc.getString();
1086 case RC_FORWARD_SEARCH_PDF:
1087 if (lexrc.next(true))
1088 forward_search_pdf = lexrc.getString();
1090 case RC_EXPORT_OVERWRITE:
1092 string const tmp = lexrc.getString();
1093 if (tmp == "all" || tmp == "true")
1094 export_overwrite = ALL_FILES;
1095 else if (tmp == "main")
1096 export_overwrite = MAIN_FILE;
1098 export_overwrite = NO_FILES;
1099 if (tmp != "ask" && tmp != "false")
1100 LYXERR0("Unrecognized export_overwrite status \""
1105 case RC_SCROLL_WHEEL_ZOOM:
1107 string const tmp = lexrc.getString();
1109 scroll_wheel_zoom = SCROLL_WHEEL_ZOOM_CTRL;
1110 else if (tmp == "shift")
1111 scroll_wheel_zoom = SCROLL_WHEEL_ZOOM_SHIFT;
1112 else if (tmp == "alt")
1113 scroll_wheel_zoom = SCROLL_WHEEL_ZOOM_ALT;
1115 scroll_wheel_zoom = SCROLL_WHEEL_ZOOM_OFF;
1116 if (tmp != "off" && tmp != "false")
1117 LYXERR0("Unrecognized scroll_wheel_zoom status \""
1123 case RC_MOUSE_MIDDLEBUTTON_PASTE:
1124 lexrc >> mouse_middlebutton_paste;
1127 case RC_BOOKMARKS_VISIBILITY:
1129 string const tmp = lexrc.getString();
1131 bookmarks_visibility = BMK_NONE;
1132 else if (tmp == "margin")
1133 bookmarks_visibility = BMK_MARGIN;
1134 else if (tmp == "inline")
1135 bookmarks_visibility = BMK_INLINE;
1137 bookmarks_visibility = BMK_NONE;
1138 LYXERR0("Unrecognized bookmark visibility " << tmp <<'"');
1143 case RC_DRAW_STRATEGY:
1145 string const tmp = lexrc.getString();
1146 if (tmp == "partial")
1147 draw_strategy = DrawStrategy::Partial;
1148 else if (tmp == "backingstore")
1149 draw_strategy = DrawStrategy::Backingstore;
1150 else if (tmp == "full")
1151 draw_strategy = DrawStrategy::Full;
1153 LYXERR0("Unrecognized draw strategy " << tmp <<'"');
1159 break; // this is just a dummy
1162 // This is triggered the first time through the loop unless
1163 // we hit a format tag.
1164 if (check_format && rc_format != LYXRC_FILEFORMAT)
1165 return FormatMismatch;
1168 /// Update converters data-structures
1169 theConverters().update(theFormats());
1170 theConverters().buildGraph();
1171 theBufferList().invalidateConverterCache();
1177 void LyXRC::write(FileName const & filename, bool ignore_system_lyxrc) const
1179 ofstream ofs(filename.toFilesystemEncoding().c_str());
1181 write(ofs, ignore_system_lyxrc);
1185 void LyXRC::print() const
1187 if (lyxerr.debugging())
1188 write(lyxerr, false);
1196 typedef pair<string, SpecialisedMover> Data;
1198 SameMover(Data const & comparison)
1199 : comparison_(comparison) {}
1201 bool operator()(Data const & data) const
1203 return data.first == comparison_.first &&
1204 data.second.command() == comparison_.second.command();
1214 // Escape \ and " so that LyXLex can read the string later
1215 string escapeCommand(string const & str) {
1216 return subst(subst(str , "\\", "\\\\"),
1223 void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) const
1225 LyXRCTags tag = RC_LAST;
1227 if (!name.empty()) {
1228 for (int i = 0; i != lyxrcCount; ++i)
1229 if ("\\" + name == lyxrcTags[i].tag)
1230 tag = static_cast<LyXRCTags>(lyxrcTags[i].code);
1234 os << "# LyX " << lyx_version
1235 << " generated this file. If you want to make your own\n"
1236 << "# modifications you should do them from inside LyX and save.\n\n"
1237 << "Format " << LYXRC_FILEFORMAT << "\n\n";
1239 // Why the switch you might ask. It is a trick to ensure that all
1240 // the elements in the LyXRCTags enum are handled. As you can see
1241 // there are no breaks at all. So it is just a huge fall-through.
1242 // The nice thing is that we will get a warning from the compiler
1243 // if we forget an element.
1247 // input/include files are not done here
1248 case RC_LYXRCFORMAT:
1250 if (ignore_system_lyxrc ||
1251 bind_file != system_lyxrc.bind_file) {
1252 string const path = os::external_path(bind_file);
1253 os << "\\bind_file \"" << path << "\"\n";
1259 if (ignore_system_lyxrc ||
1260 def_file != system_lyxrc.def_file) {
1261 string const path = os::external_path(def_file);
1262 os << "\\def_file \"" << path << "\"\n";
1271 << "# MISC SECTION ######################################\n"
1273 // bind files are not done here.
1275 case RC_PATH_PREFIX:
1276 if (ignore_system_lyxrc ||
1277 path_prefix != system_lyxrc.path_prefix) {
1278 os << "\\path_prefix \"" << path_prefix << "\"\n";
1284 if (ignore_system_lyxrc ||
1285 ui_file != system_lyxrc.ui_file) {
1286 string const path = os::external_path(ui_file);
1287 os << "\\ui_file \"" << path << "\"\n";
1292 case RC_AUTOREGIONDELETE:
1293 if (ignore_system_lyxrc ||
1294 auto_region_delete != system_lyxrc.auto_region_delete) {
1295 os << "# Set to false to inhibit automatic replacement of\n"
1296 << "# the current selection.\n"
1297 << "\\auto_region_delete " << convert<string>(auto_region_delete)
1303 case RC_AUTORESET_OPTIONS:
1304 if (ignore_system_lyxrc ||
1305 auto_reset_options != system_lyxrc.auto_reset_options) {
1306 os << "# Set to false to inhibit automatic reset of\n"
1307 << "# the class options to defaults on class change.\n"
1308 << "\\auto_reset_options "
1309 << convert<string>(auto_reset_options)
1316 if (ignore_system_lyxrc ||
1317 autosave != system_lyxrc.autosave) {
1318 os << "# The time interval between auto-saves in seconds.\n"
1319 << "\\autosave " << autosave << '\n';
1324 case RC_DISPLAY_GRAPHICS:
1325 if (ignore_system_lyxrc ||
1326 display_graphics != system_lyxrc.display_graphics) {
1327 os << "# Display graphics within LyX\n"
1329 << "\\display_graphics "
1330 << (display_graphics ? "true" : "false")
1336 case RC_SORT_LAYOUTS:
1337 if (ignore_system_lyxrc ||
1338 sort_layouts != system_lyxrc.sort_layouts) {
1339 os << "# Sort layouts alphabetically.\n"
1340 << "\\sort_layouts " << convert<string>(sort_layouts) << '\n';
1345 case RC_GROUP_LAYOUTS:
1346 if (ignore_system_lyxrc ||
1347 group_layouts != system_lyxrc.group_layouts) {
1348 os << "# Group layouts by their category.\n"
1349 << "\\group_layouts " << convert<string>(group_layouts) << '\n';
1354 case RC_VIEWDVI_PAPEROPTION:
1355 if (ignore_system_lyxrc ||
1356 view_dvi_paper_option
1357 != system_lyxrc.view_dvi_paper_option) {
1358 os << "# Options used to specify paper size to the\n"
1359 << "# view_dvi_command (e.g. -paper)\n"
1360 << "\\view_dvi_paper_option \""
1361 << view_dvi_paper_option << "\"\n";
1366 case RC_CHKTEX_COMMAND:
1367 if (ignore_system_lyxrc ||
1368 chktex_command != system_lyxrc.chktex_command) {
1369 os << "\\chktex_command \"" << escapeCommand(chktex_command) << "\"\n";
1374 case RC_BIBTEX_ALTERNATIVES: {
1375 CommandSet::const_iterator it = bibtex_alternatives.begin();
1376 CommandSet::const_iterator end = bibtex_alternatives.end();
1377 for ( ; it != end; ++it) {
1378 if (ignore_system_lyxrc
1379 || !system_lyxrc.bibtex_alternatives.count(*it))
1380 os << "\\bibtex_alternatives \""
1387 case RC_BIBTEX_COMMAND:
1388 if (ignore_system_lyxrc ||
1389 bibtex_command != system_lyxrc.bibtex_command) {
1390 os << "\\bibtex_command \"" << escapeCommand(bibtex_command) << "\"\n";
1395 case RC_JBIBTEX_COMMAND:
1396 if (ignore_system_lyxrc ||
1397 jbibtex_command != system_lyxrc.jbibtex_command) {
1398 os << "\\jbibtex_command \"" << escapeCommand(jbibtex_command) << "\"\n";
1403 case RC_JBIBTEX_ALTERNATIVES: {
1404 CommandSet::const_iterator it = jbibtex_alternatives.begin();
1405 CommandSet::const_iterator end = jbibtex_alternatives.end();
1406 for ( ; it != end; ++it) {
1407 if (ignore_system_lyxrc
1408 || !system_lyxrc.jbibtex_alternatives.count(*it))
1409 os << "\\jbibtex_alternatives \""
1416 case RC_INDEX_ALTERNATIVES: {
1417 CommandSet::const_iterator it = index_alternatives.begin();
1418 CommandSet::const_iterator end = index_alternatives.end();
1419 for ( ; it != end; ++it) {
1420 if (ignore_system_lyxrc
1421 || !system_lyxrc.index_alternatives.count(*it))
1422 os << "\\index_alternatives \""
1429 case RC_INDEX_COMMAND:
1430 if (ignore_system_lyxrc ||
1431 index_command != system_lyxrc.index_command) {
1432 os << "\\index_command \"" << escapeCommand(index_command) << "\"\n";
1437 case RC_JINDEX_COMMAND:
1438 if (ignore_system_lyxrc ||
1439 jindex_command != system_lyxrc.jindex_command) {
1440 os << "\\jindex_command \"" << escapeCommand(jindex_command) << "\"\n";
1445 case RC_SPLITINDEX_COMMAND:
1446 if (ignore_system_lyxrc ||
1447 splitindex_command != system_lyxrc.splitindex_command) {
1448 os << "\\splitindex_command \"" << escapeCommand(splitindex_command) << "\"\n";
1453 case RC_NOMENCL_COMMAND:
1454 if (ignore_system_lyxrc ||
1455 nomencl_command != system_lyxrc.nomencl_command) {
1456 os << "\\nomencl_command \"" << escapeCommand(nomencl_command) << "\"\n";
1461 case RC_PYGMENTIZE_COMMAND:
1462 if (ignore_system_lyxrc ||
1463 pygmentize_command != system_lyxrc.pygmentize_command) {
1464 os << "\\pygmentize_command \"" << escapeCommand(pygmentize_command) << "\"\n";
1469 case RC_TEX_EXPECTS_WINDOWS_PATHS:
1470 // Don't write this setting to the preferences file,
1471 // but allow temporary changes (bug 7557).
1472 if (ignore_system_lyxrc) {
1473 os << "\\tex_expects_windows_paths "
1474 << convert<string>(windows_style_tex_paths) << '\n';
1479 case RC_TEX_ALLOWS_SPACES:
1480 if (tex_allows_spaces != system_lyxrc.tex_allows_spaces) {
1481 os << "\\tex_allows_spaces "
1482 << convert<string>(tex_allows_spaces) << '\n';
1488 if (ignore_system_lyxrc ||
1489 use_kbmap != system_lyxrc.use_kbmap) {
1490 os << "\\kbmap " << convert<string>(use_kbmap) << '\n';
1495 case RC_KBMAP_PRIMARY:
1496 if (ignore_system_lyxrc ||
1497 primary_kbmap != system_lyxrc.primary_kbmap) {
1498 string const path = os::external_path(primary_kbmap);
1499 os << "\\kbmap_primary \"" << path << "\"\n";
1504 case RC_KBMAP_SECONDARY:
1505 if (ignore_system_lyxrc ||
1506 secondary_kbmap != system_lyxrc.secondary_kbmap) {
1507 string const path = os::external_path(secondary_kbmap);
1508 os << "\\kbmap_secondary \"" << path << "\"\n";
1514 if (ignore_system_lyxrc ||
1515 lyxpipes != system_lyxrc.lyxpipes) {
1516 string const path = os::external_path(lyxpipes);
1517 os << "\\serverpipe \"" << path << "\"\n";
1523 os << "\\user_name \"" << user_name << "\"\n";
1528 os << "\\user_email \"" << user_email << "\"\n";
1532 case RC_USER_INITIALS:
1533 os << "\\user_initials \"" << user_initials << "\"\n";
1537 case RC_SHOW_BANNER:
1538 if (ignore_system_lyxrc ||
1539 show_banner != system_lyxrc.show_banner) {
1540 os << "\\show_banner " << convert<string>(show_banner) << '\n';
1546 if (ignore_system_lyxrc ||
1547 preview != system_lyxrc.preview) {
1553 case PREVIEW_NO_MATH:
1560 os << "\\preview " << status << '\n';
1565 case RC_PREVIEW_HASHED_LABELS:
1566 if (ignore_system_lyxrc ||
1567 preview_hashed_labels !=
1568 system_lyxrc.preview_hashed_labels) {
1569 os << "\\preview_hashed_labels "
1570 << convert<string>(preview_hashed_labels) << '\n';
1575 case RC_PREVIEW_SCALE_FACTOR:
1576 if (ignore_system_lyxrc ||
1577 preview_scale_factor != system_lyxrc.preview_scale_factor) {
1578 os << "\\preview_scale_factor "
1579 << preview_scale_factor << '\n';
1584 case RC_USE_CONVERTER_CACHE:
1585 if (ignore_system_lyxrc ||
1586 use_converter_cache != system_lyxrc.use_converter_cache) {
1587 os << "\\use_converter_cache "
1588 << convert<string>(use_converter_cache) << '\n';
1593 case RC_USE_CONVERTER_NEEDAUTH_FORBIDDEN:
1594 if (ignore_system_lyxrc ||
1595 use_converter_needauth_forbidden != system_lyxrc.use_converter_needauth_forbidden) {
1596 os << "\\use_converter_needauth_forbidden "
1597 << convert<string>(use_converter_needauth_forbidden) << '\n';
1602 case RC_USE_CONVERTER_NEEDAUTH:
1603 if (ignore_system_lyxrc ||
1604 use_converter_needauth != system_lyxrc.use_converter_needauth) {
1605 os << "\\use_converter_needauth "
1606 << convert<string>(use_converter_needauth) << '\n';
1611 case RC_CONVERTER_CACHE_MAXAGE:
1612 if (ignore_system_lyxrc ||
1613 converter_cache_maxage != system_lyxrc.converter_cache_maxage) {
1614 os << "\\converter_cache_maxage "
1615 << converter_cache_maxage << '\n';
1621 << "# SCREEN & FONTS SECTION ############################\n"
1625 if (ignore_system_lyxrc ||
1626 icon_set != system_lyxrc.icon_set) {
1627 os << "\\icon_set \"" << icon_set
1634 if (ignore_system_lyxrc ||
1635 ui_style != system_lyxrc.ui_style) {
1636 os << "\\ui_style \"" << ui_style
1642 case RC_USE_SYSTEM_THEME_ICONS:
1643 if (ignore_system_lyxrc ||
1644 use_system_theme_icons != system_lyxrc.use_system_theme_icons) {
1645 os << "\\use_system_theme_icons "
1646 << convert<string>(use_system_theme_icons)
1653 if (ignore_system_lyxrc ||
1654 dpi != system_lyxrc.dpi) {
1655 os << "\\screen_dpi " << dpi << '\n';
1660 case RC_SCREEN_ZOOM:
1661 if (ignore_system_lyxrc ||
1662 defaultZoom != system_lyxrc.defaultZoom) {
1663 os << "\\screen_zoom " << defaultZoom << '\n';
1668 case RC_GEOMETRY_SESSION:
1669 if (ignore_system_lyxrc ||
1670 allow_geometry_session != system_lyxrc.allow_geometry_session) {
1671 os << "\\allow_geometry_session " << convert<string>(allow_geometry_session)
1677 case RC_CITATION_SEARCH:
1678 if (ignore_system_lyxrc ||
1679 citation_search != system_lyxrc.citation_search) {
1680 os << "# Set to true to use script to search"
1681 << " local disk for citation targets.\n"
1682 << "\\citation_search "
1683 << convert<string>(citation_search)
1689 case RC_CITATION_SEARCH_VIEW:
1690 if (ignore_system_lyxrc ||
1691 citation_search_view != system_lyxrc.citation_search_view) {
1692 os << "\\citation_search_view \""
1693 << citation_search_view << "\"\n";
1698 case RC_CITATION_SEARCH_PATTERN:
1699 if (ignore_system_lyxrc ||
1700 citation_search_pattern != system_lyxrc.citation_search_pattern) {
1701 os << "\\citation_search_pattern \""
1702 << citation_search_pattern << "\"\n";
1707 case RC_CT_ADDITIONS_UNDERLINED:
1708 if (ignore_system_lyxrc ||
1709 ct_additions_underlined
1710 != system_lyxrc.ct_additions_underlined) {
1711 os << "\\ct_additions_underlined "
1712 << convert<string>(ct_additions_underlined) << '\n';
1717 case RC_CT_MARKUP_COPIED:
1718 if (ignore_system_lyxrc ||
1720 != system_lyxrc.ct_markup_copied) {
1721 os << "\\ct_markup_copied "
1722 << convert<string>(ct_markup_copied) << '\n';
1727 case RC_CURSOR_FOLLOWS_SCROLLBAR:
1728 if (ignore_system_lyxrc ||
1729 cursor_follows_scrollbar
1730 != system_lyxrc.cursor_follows_scrollbar) {
1731 os << "\\cursor_follows_scrollbar "
1732 << convert<string>(cursor_follows_scrollbar) << '\n';
1737 case RC_CURSOR_WIDTH:
1738 if (ignore_system_lyxrc ||
1740 != system_lyxrc.cursor_width) {
1741 os << "\\cursor_width "
1742 << cursor_width << '\n';
1747 case RC_SCROLL_BELOW_DOCUMENT:
1748 if (ignore_system_lyxrc ||
1749 scroll_below_document
1750 != system_lyxrc.scroll_below_document) {
1751 os << "\\scroll_below_document "
1752 << convert<string>(scroll_below_document) << '\n';
1757 case RC_PARAGRAPH_MARKERS:
1758 if (ignore_system_lyxrc ||
1760 != system_lyxrc.paragraph_markers) {
1761 os << "\\paragraph_markers "
1762 << convert<string>(paragraph_markers) << '\n';
1767 case RC_BOOKMARKS_VISIBILITY:
1768 if (ignore_system_lyxrc ||
1769 bookmarks_visibility != system_lyxrc.bookmarks_visibility) {
1771 switch (bookmarks_visibility) {
1782 os << "\\experimental:bookmarks_visibility " << status << '\n';
1787 case RC_MAC_DONTSWAP_CTRL_META:
1788 if (ignore_system_lyxrc ||
1789 mac_dontswap_ctrl_meta
1790 != system_lyxrc.mac_dontswap_ctrl_meta) {
1791 os << "\\mac_dontswap_ctrl_meta "
1792 << convert<string>(mac_dontswap_ctrl_meta) << '\n';
1797 case RC_MAC_LIKE_CURSOR_MOVEMENT:
1798 if (ignore_system_lyxrc ||
1799 mac_like_cursor_movement
1800 != system_lyxrc.mac_like_cursor_movement) {
1801 os << "\\mac_like_cursor_movement "
1802 << convert<string>(mac_like_cursor_movement) << '\n';
1807 case RC_MACRO_EDIT_STYLE:
1808 if (ignore_system_lyxrc ||
1810 != system_lyxrc.macro_edit_style) {
1811 os << "\\macro_edit_style ";
1812 switch (macro_edit_style) {
1813 case MACRO_EDIT_INLINE_BOX: os << "0\n"; break;
1814 case MACRO_EDIT_INLINE: os << "1\n"; break;
1815 case MACRO_EDIT_LIST: os << "2\n"; break;
1821 case RC_DIALOGS_ICONIFY_WITH_MAIN:
1822 if (ignore_system_lyxrc ||
1823 dialogs_iconify_with_main
1824 != system_lyxrc.dialogs_iconify_with_main) {
1825 os << "\\dialogs_iconify_with_main "
1826 << convert<string>(dialogs_iconify_with_main) << '\n';
1831 case RC_SCREEN_FONT_ROMAN:
1832 if (ignore_system_lyxrc ||
1833 roman_font_name != system_lyxrc.roman_font_name) {
1834 os << "\\screen_font_roman \"" << roman_font_name
1840 case RC_SCREEN_FONT_ROMAN_FOUNDRY:
1841 if (ignore_system_lyxrc ||
1842 roman_font_foundry != system_lyxrc.roman_font_foundry) {
1843 os << "\\screen_font_roman_foundry \"" << roman_font_foundry
1849 case RC_SCREEN_FONT_SANS:
1850 if (ignore_system_lyxrc ||
1851 sans_font_name != system_lyxrc.sans_font_name) {
1852 os << "\\screen_font_sans \"" << sans_font_name
1858 case RC_SCREEN_FONT_SANS_FOUNDRY:
1859 if (ignore_system_lyxrc ||
1860 sans_font_foundry != system_lyxrc.sans_font_foundry) {
1861 os << "\\screen_font_sans_foundry \"" << sans_font_foundry
1867 case RC_SCREEN_FONT_TYPEWRITER:
1868 if (ignore_system_lyxrc ||
1869 typewriter_font_name != system_lyxrc.typewriter_font_name) {
1870 os << "\\screen_font_typewriter \""
1871 << typewriter_font_name << "\"\n";
1876 case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
1877 if (ignore_system_lyxrc ||
1878 typewriter_font_foundry != system_lyxrc.typewriter_font_foundry) {
1879 os << "\\screen_font_typewriter_foundry \""
1880 << typewriter_font_foundry << "\"\n";
1885 case RC_SCREEN_FONT_SCALABLE:
1886 if (ignore_system_lyxrc ||
1887 use_scalable_fonts != system_lyxrc.use_scalable_fonts) {
1888 os << "\\screen_font_scalable "
1889 << convert<string>(use_scalable_fonts)
1895 case RC_SCREEN_FONT_SIZES:
1896 if (ignore_system_lyxrc ||
1897 font_sizes[TINY_SIZE]
1898 != system_lyxrc.font_sizes[TINY_SIZE] ||
1899 font_sizes[SCRIPT_SIZE]
1900 != system_lyxrc.font_sizes[SCRIPT_SIZE] ||
1901 font_sizes[FOOTNOTE_SIZE]
1902 != system_lyxrc.font_sizes[FOOTNOTE_SIZE] ||
1903 font_sizes[SMALL_SIZE]
1904 != system_lyxrc.font_sizes[SMALL_SIZE] ||
1905 font_sizes[NORMAL_SIZE]
1906 != system_lyxrc.font_sizes[NORMAL_SIZE] ||
1907 font_sizes[LARGE_SIZE]
1908 != system_lyxrc.font_sizes[LARGE_SIZE] ||
1909 font_sizes[LARGER_SIZE]
1910 != system_lyxrc.font_sizes[LARGER_SIZE] ||
1911 font_sizes[LARGEST_SIZE]
1912 != system_lyxrc.font_sizes[LARGEST_SIZE] ||
1913 font_sizes[HUGE_SIZE]
1914 != system_lyxrc.font_sizes[HUGE_SIZE] ||
1915 font_sizes[HUGER_SIZE]
1916 != system_lyxrc.font_sizes[HUGER_SIZE]) {
1917 streamsize old_prec = os.precision();
1918 os.setf(ios::fixed);
1920 os << "\\screen_font_sizes"
1921 << ' ' << font_sizes[TINY_SIZE]
1922 << ' ' << font_sizes[SCRIPT_SIZE]
1923 << ' ' << font_sizes[FOOTNOTE_SIZE]
1924 << ' ' << font_sizes[SMALL_SIZE]
1925 << ' ' << font_sizes[NORMAL_SIZE]
1926 << ' ' << font_sizes[LARGE_SIZE]
1927 << ' ' << font_sizes[LARGER_SIZE]
1928 << ' ' << font_sizes[LARGEST_SIZE]
1929 << ' ' << font_sizes[HUGE_SIZE]
1930 << ' ' << font_sizes[HUGER_SIZE]
1932 os.precision(old_prec);
1933 os.unsetf(ios::fixed);
1938 case RC_SCREEN_LIMIT:
1939 if (ignore_system_lyxrc ||
1940 screen_limit != system_lyxrc.screen_limit) {
1941 os << "\\screen_limit "
1942 << convert<string>(screen_limit)
1948 case RC_FULL_SCREEN_TOOLBARS:
1949 if (ignore_system_lyxrc ||
1950 full_screen_toolbars != system_lyxrc.full_screen_toolbars) {
1951 os << "\\fullscreen_toolbars "
1952 << convert<string>(full_screen_toolbars)
1958 case RC_FULL_SCREEN_SCROLLBAR:
1959 if (ignore_system_lyxrc ||
1960 full_screen_scrollbar != system_lyxrc.full_screen_scrollbar) {
1961 os << "\\fullscreen_scrollbar "
1962 << convert<string>(full_screen_scrollbar)
1968 case RC_FULL_SCREEN_STATUSBAR:
1969 if (ignore_system_lyxrc ||
1970 full_screen_statusbar != system_lyxrc.full_screen_statusbar) {
1971 os << "\\fullscreen_statusbar "
1972 << convert<string>(full_screen_statusbar)
1978 case RC_FULL_SCREEN_TABBAR:
1979 if (ignore_system_lyxrc ||
1980 full_screen_tabbar != system_lyxrc.full_screen_tabbar) {
1981 os << "\\fullscreen_tabbar "
1982 << convert<string>(full_screen_tabbar)
1988 case RC_FULL_SCREEN_MENUBAR:
1989 if (ignore_system_lyxrc ||
1990 full_screen_menubar != system_lyxrc.full_screen_menubar) {
1991 os << "\\fullscreen_menubar "
1992 << convert<string>(full_screen_menubar)
1998 case RC_SCREEN_WIDTH:
1999 if (ignore_system_lyxrc ||
2000 screen_width != system_lyxrc.screen_width) {
2001 os << "\\screen_width "
2002 << screen_width.asString()
2008 case RC_OPEN_BUFFERS_IN_TABS:
2009 if (ignore_system_lyxrc ||
2010 open_buffers_in_tabs != system_lyxrc.open_buffers_in_tabs) {
2011 os << "\\open_buffers_in_tabs "
2012 << convert<string>(open_buffers_in_tabs)
2018 case RC_SINGLE_CLOSE_TAB_BUTTON:
2019 if (ignore_system_lyxrc ||
2020 single_close_tab_button != system_lyxrc.single_close_tab_button) {
2021 os << "\\single_close_tab_button "
2022 << convert<string>(single_close_tab_button)
2028 case RC_SINGLE_INSTANCE:
2029 if (ignore_system_lyxrc ||
2030 single_instance != system_lyxrc.single_instance) {
2031 os << "\\single_instance "
2032 << convert<string>(single_instance)
2038 case RC_FORWARD_SEARCH_DVI:
2039 if (ignore_system_lyxrc ||
2040 forward_search_dvi != system_lyxrc.forward_search_dvi) {
2041 os << "\\forward_search_dvi \"" << escapeCommand(forward_search_dvi) << "\"\n";
2046 case RC_FORWARD_SEARCH_PDF:
2047 if (ignore_system_lyxrc ||
2048 forward_search_pdf != system_lyxrc.forward_search_pdf) {
2049 os << "\\forward_search_pdf \"" << escapeCommand(forward_search_pdf) << "\"\n";
2054 case RC_DRAW_STRATEGY:
2055 if (ignore_system_lyxrc ||
2056 draw_strategy != system_lyxrc.draw_strategy) {
2058 switch (draw_strategy) {
2059 case DrawStrategy::Full:
2062 case DrawStrategy::Partial:
2065 case DrawStrategy::Backingstore:
2066 status = "backingstore";
2069 os << "\\draw_strategy " << status << '\n';
2076 << "# COLOR SECTION ###################################\n"
2081 for (int i = 0; i < Color_ignore; ++i) {
2082 ColorCode lc = static_cast<ColorCode>(i);
2083 string const col = lcolor.getAllX11HexNames(lc).first;
2084 string const darkcol = lcolor.getAllX11HexNames(lc).second;
2085 if (ignore_system_lyxrc
2086 || col != system_lcolor.getAllX11HexNames(lc).first
2087 || darkcol != system_lcolor.getAllX11HexNames(lc).second) {
2088 os << "\\set_color \""
2089 << lcolor.getLyXName(lc) << "\" \""
2091 << darkcol << "\"\n";
2098 << "# PRINTER SECTION ###################################\n"
2102 case RC_PRINTLANDSCAPEFLAG:
2103 if (ignore_system_lyxrc ||
2104 print_landscape_flag != system_lyxrc.print_landscape_flag) {
2105 os << "\\print_landscape_flag \"" << print_landscape_flag
2111 case RC_PRINTPAPERFLAG:
2112 if (ignore_system_lyxrc ||
2113 print_paper_flag != system_lyxrc.print_paper_flag) {
2114 os << "\\print_paper_flag \"" << print_paper_flag
2120 case RC_PRINTPAPERDIMENSIONFLAG:
2121 if (ignore_system_lyxrc ||
2122 print_paper_dimension_flag
2123 != system_lyxrc.print_paper_dimension_flag) {
2124 os << "\\print_paper_dimension_flag \""
2125 << print_paper_dimension_flag << "\"\n";
2131 << "# TEX SECTION #######################################\n"
2135 case RC_TEXINPUTS_PREFIX:
2136 if (ignore_system_lyxrc ||
2137 texinputs_prefix != system_lyxrc.texinputs_prefix) {
2138 os << "\\texinputs_prefix \"" << texinputs_prefix << "\"\n";
2144 << "# FILE SECTION ######################################\n"
2147 case RC_DOCUMENTPATH:
2148 if (ignore_system_lyxrc ||
2149 document_path != system_lyxrc.document_path) {
2150 string const path = os::external_path(document_path);
2151 os << "\\document_path \"" << path << "\"\n";
2156 case RC_USELASTFILEPOS:
2157 if (ignore_system_lyxrc ||
2158 use_lastfilepos != system_lyxrc.use_lastfilepos) {
2159 os << "\\use_lastfilepos " << convert<string>(use_lastfilepos)
2165 case RC_LOADSESSION:
2166 if (ignore_system_lyxrc ||
2167 load_session != system_lyxrc.load_session) {
2168 os << "\\load_session " << convert<string>(load_session)
2174 case RC_MOUSE_WHEEL_SPEED:
2175 if (ignore_system_lyxrc ||
2176 mouse_wheel_speed != system_lyxrc.mouse_wheel_speed) {
2177 os << "\\mouse_wheel_speed " << mouse_wheel_speed << '\n';
2182 case RC_MOUSE_MIDDLEBUTTON_PASTE:
2183 if (ignore_system_lyxrc ||
2184 mouse_middlebutton_paste != system_lyxrc.mouse_middlebutton_paste) {
2185 os << "\\mouse_middlebutton_paste "
2186 << convert<string>(mouse_middlebutton_paste) << '\n';
2191 case RC_COMPLETION_INLINE_DELAY:
2192 if (ignore_system_lyxrc ||
2193 completion_inline_delay != system_lyxrc.completion_inline_delay) {
2194 os << "\\completion_inline_delay " << completion_inline_delay << '\n';
2199 case RC_COMPLETION_INLINE_MATH:
2200 if (ignore_system_lyxrc ||
2201 completion_inline_math != system_lyxrc.completion_inline_math) {
2202 os << "\\completion_inline_math "
2203 << convert<string>(completion_inline_math) << '\n';
2208 case RC_COMPLETION_INLINE_TEXT:
2209 if (ignore_system_lyxrc ||
2210 completion_inline_text != system_lyxrc.completion_inline_text) {
2211 os << "\\completion_inline_text "
2212 << convert<string>(completion_inline_text) << '\n';
2217 case RC_COMPLETION_INLINE_DOTS:
2218 if (ignore_system_lyxrc ||
2219 completion_inline_dots != system_lyxrc.completion_inline_dots) {
2220 os << "\\completion_inline_dots "
2221 << convert<string>(completion_inline_dots) << '\n';
2226 case RC_AUTOCORRECTION_MATH:
2227 if (ignore_system_lyxrc ||
2228 autocorrection_math != system_lyxrc.autocorrection_math) {
2229 os << "\\autocorrection_math "
2230 << convert<string>(autocorrection_math) << '\n';
2235 case RC_COMPLETION_POPUP_DELAY:
2236 if (ignore_system_lyxrc ||
2237 completion_popup_delay != system_lyxrc.completion_popup_delay) {
2238 os << "\\completion_popup_delay " << completion_popup_delay << '\n';
2243 case RC_COMPLETION_POPUP_MATH:
2244 if (ignore_system_lyxrc ||
2245 completion_popup_math != system_lyxrc.completion_popup_math) {
2246 os << "\\completion_popup_math "
2247 << convert<string>(completion_popup_math) << '\n';
2252 case RC_COMPLETION_POPUP_TEXT:
2253 if (ignore_system_lyxrc ||
2254 completion_popup_text != system_lyxrc.completion_popup_text) {
2255 os << "\\completion_popup_text "
2256 << convert<string>(completion_popup_text) << '\n';
2261 case RC_COMPLETION_CURSOR_TEXT:
2262 if (ignore_system_lyxrc ||
2263 completion_cursor_text != system_lyxrc.completion_cursor_text) {
2264 os << "\\completion_cursor_text "
2265 << convert<string>(completion_cursor_text) << '\n';
2270 case RC_COMPLETION_POPUP_AFTER_COMPLETE:
2271 if (ignore_system_lyxrc ||
2272 completion_popup_after_complete
2273 != system_lyxrc.completion_popup_after_complete) {
2274 os << "\\completion_popup_after_complete "
2275 << convert<string>(completion_popup_after_complete) << '\n';
2280 case RC_COMPLETION_MINLENGTH:
2281 if (ignore_system_lyxrc ||
2282 completion_minlength != system_lyxrc.completion_minlength) {
2283 os << "\\completion_minlength " << convert<string>(completion_minlength)
2289 case RC_NUMLASTFILES:
2290 if (ignore_system_lyxrc ||
2291 num_lastfiles != system_lyxrc.num_lastfiles) {
2292 os << "\\num_lastfiles " << num_lastfiles << '\n';
2297 case RC_CHECKLASTFILES:
2298 if (ignore_system_lyxrc ||
2299 check_lastfiles != system_lyxrc.check_lastfiles) {
2300 os << "\\check_lastfiles " << convert<string>(check_lastfiles)
2306 case RC_EXAMPLEPATH:
2307 if (ignore_system_lyxrc ||
2308 example_path != system_lyxrc.example_path) {
2309 string const path = os::external_path(example_path);
2310 os << "\\example_path \"" << path << "\"\n";
2315 case RC_TEMPLATEPATH:
2316 if (ignore_system_lyxrc ||
2317 template_path != system_lyxrc.template_path) {
2318 string const path = os::external_path(template_path);
2319 os << "\\template_path \"" << path << "\"\n";
2324 case RC_TEMPDIRPATH:
2325 if (ignore_system_lyxrc ||
2326 tempdir_path != system_lyxrc.tempdir_path) {
2327 string const path = os::external_path(tempdir_path);
2328 os << "\\tempdir_path \"" << path << "\"\n";
2333 case RC_THESAURUSDIRPATH:
2334 if (ignore_system_lyxrc ||
2335 thesaurusdir_path != system_lyxrc.thesaurusdir_path) {
2336 string const path = os::external_path(thesaurusdir_path);
2337 os << "\\thesaurusdir_path \"" << path << "\"\n";
2342 case RC_HUNSPELLDIR_PATH:
2343 if (ignore_system_lyxrc ||
2344 hunspelldir_path != system_lyxrc.hunspelldir_path) {
2345 string const path = os::external_path(hunspelldir_path);
2346 os << "\\hunspelldir_path \"" << path << "\"\n";
2351 case RC_PLAINTEXT_LINELEN:
2352 if (ignore_system_lyxrc ||
2353 plaintext_linelen != system_lyxrc.plaintext_linelen) {
2354 os << "\\plaintext_linelen " << plaintext_linelen << '\n';
2359 case RC_MAKE_BACKUP:
2360 if (ignore_system_lyxrc ||
2361 make_backup != system_lyxrc.make_backup) {
2362 os << "\\make_backup " << convert<string>(make_backup) << '\n';
2367 case RC_SAVE_COMPRESSED:
2368 if (ignore_system_lyxrc ||
2369 save_compressed != system_lyxrc.save_compressed) {
2370 os << "\\save_compressed " << convert<string>(save_compressed) << '\n';
2375 case RC_SAVE_ORIGIN:
2376 if (ignore_system_lyxrc ||
2377 save_origin != system_lyxrc.save_origin) {
2378 os << "\\save_origin " << convert<string>(save_origin) << '\n';
2383 case RC_BACKUPDIR_PATH:
2384 if (ignore_system_lyxrc ||
2385 backupdir_path != system_lyxrc.backupdir_path) {
2386 string const path = os::external_path(backupdir_path);
2387 os << "\\backupdir_path \"" << path << "\"\n";
2393 << "# PLAIN TEXT EXPORT SECTION ##############################\n"
2397 << "# SPELLCHECKER SECTION ##############################\n"
2401 case RC_ACCEPT_COMPOUND:
2402 if (ignore_system_lyxrc ||
2403 spellchecker_accept_compound != system_lyxrc.spellchecker_accept_compound) {
2404 os << "\\accept_compound " << convert<string>(spellchecker_accept_compound)
2411 if (ignore_system_lyxrc ||
2412 spellchecker_alt_lang != system_lyxrc.spellchecker_alt_lang) {
2413 os << "\\alternate_language \"" << spellchecker_alt_lang
2420 if (ignore_system_lyxrc ||
2421 spellchecker_esc_chars != system_lyxrc.spellchecker_esc_chars) {
2422 os << "\\escape_chars \"" << spellchecker_esc_chars << "\"\n";
2427 case RC_USE_NATIVE_FILEDIALOG:
2428 if (ignore_system_lyxrc ||
2429 use_native_filedialog != system_lyxrc.use_native_filedialog) {
2430 os << "\\use_native_filedialog "
2431 << convert<string>(use_native_filedialog)
2437 case RC_USE_SYSTEM_COLORS:
2438 if (ignore_system_lyxrc ||
2439 use_system_colors != system_lyxrc.use_system_colors) {
2440 os << "\\use_system_colors "
2441 << convert<string>(use_system_colors)
2447 case RC_USE_TOOLTIP:
2448 if (ignore_system_lyxrc ||
2449 use_tooltip != system_lyxrc.use_tooltip) {
2450 os << "\\use_tooltip "
2451 << convert<string>(use_tooltip)
2459 << "# LANGUAGE SUPPORT SECTION ##########################\n"
2463 case RC_DEFAULT_DECIMAL_SEP:
2464 if (ignore_system_lyxrc ||
2465 default_decimal_sep != system_lyxrc.default_decimal_sep) {
2466 os << "\\default_decimal_point \"" << default_decimal_sep << "\"" << '\n';
2471 case RC_DEFAULT_LENGTH_UNIT:
2472 if (ignore_system_lyxrc ||
2473 default_length_unit != system_lyxrc.default_length_unit) {
2474 os << "\\default_length_unit " << int(default_length_unit) << '\n';
2479 case RC_SPELLCHECKER:
2480 if (ignore_system_lyxrc ||
2481 spellchecker != system_lyxrc.spellchecker) {
2482 os << "\\spellchecker " << spellchecker << '\n';
2487 case RC_SPELLCHECK_CONTINUOUSLY:
2488 if (ignore_system_lyxrc ||
2489 spellcheck_continuously != system_lyxrc.spellcheck_continuously) {
2490 os << "\\spellcheck_continuously " << convert<string>(spellcheck_continuously)
2496 case RC_SPELLCHECK_NOTES:
2497 if (ignore_system_lyxrc ||
2498 spellcheck_notes != system_lyxrc.spellcheck_notes) {
2499 os << "\\spellcheck_notes " << convert<string>(spellcheck_notes)
2505 case RC_VISUAL_CURSOR:
2506 if (ignore_system_lyxrc ||
2507 visual_cursor != system_lyxrc.visual_cursor) {
2508 os << "\\visual_cursor " << convert<string>(visual_cursor) << '\n';
2513 case RC_CLOSE_BUFFER_WITH_LAST_VIEW:
2514 if (ignore_system_lyxrc ||
2515 close_buffer_with_last_view != system_lyxrc.close_buffer_with_last_view) {
2516 os << "# When closing last view, buffer closes (yes), hides (no), or ask the user (ask)\n";
2517 os << "\\close_buffer_with_last_view " << close_buffer_with_last_view << '\n';
2522 case RC_LANGUAGE_CUSTOM_PACKAGE:
2523 if (ignore_system_lyxrc ||
2524 language_custom_package != system_lyxrc.language_custom_package) {
2525 os << "\\language_custom_package \"" << language_custom_package
2531 case RC_LANGUAGE_GLOBAL_OPTIONS:
2532 if (ignore_system_lyxrc ||
2533 language_global_options
2534 != system_lyxrc.language_global_options) {
2535 os << "\\language_global_options \""
2536 << convert<string>(language_global_options)
2542 case RC_LANGUAGE_PACKAGE_SELECTION:
2543 if (ignore_system_lyxrc ||
2544 language_package_selection != system_lyxrc.language_package_selection) {
2545 os << "\\language_package_selection ";
2546 switch (language_package_selection) {
2564 case RC_LANGUAGE_COMMAND_BEGIN:
2565 if (ignore_system_lyxrc ||
2566 language_command_begin
2567 != system_lyxrc.language_command_begin) {
2568 os << "\\language_command_begin \""
2569 << language_command_begin
2575 case RC_LANGUAGE_COMMAND_END:
2576 if (ignore_system_lyxrc ||
2577 language_command_end
2578 != system_lyxrc.language_command_end) {
2579 os << "\\language_command_end \"" << language_command_end
2585 case RC_LANGUAGE_COMMAND_LOCAL:
2586 if (ignore_system_lyxrc ||
2587 language_command_local
2588 != system_lyxrc.language_command_local) {
2589 os << "\\language_command_local \""
2590 << language_command_local
2596 case RC_LANGUAGE_AUTO_BEGIN:
2597 if (ignore_system_lyxrc ||
2598 language_auto_begin != system_lyxrc.language_auto_begin) {
2599 os << "\\language_auto_begin "
2600 << convert<string>(language_auto_begin) << '\n';
2605 case RC_LANGUAGE_AUTO_END:
2606 if (ignore_system_lyxrc ||
2607 language_auto_end != system_lyxrc.language_auto_end) {
2608 os << "\\language_auto_end "
2609 << convert<string>(language_auto_end) << '\n';
2614 case RC_MARK_FOREIGN_LANGUAGE:
2615 if (ignore_system_lyxrc ||
2616 mark_foreign_language
2617 != system_lyxrc.mark_foreign_language) {
2618 os << "\\mark_foreign_language " <<
2619 convert<string>(mark_foreign_language) << '\n';
2622 case RC_RESPECT_OS_KBD_LANGUAGE:
2623 if (ignore_system_lyxrc ||
2624 respect_os_kbd_language
2625 != system_lyxrc.respect_os_kbd_language) {
2626 os << "\\respect_os_kbd_language " <<
2627 convert<string>(respect_os_kbd_language) << '\n';
2634 << "# 2nd MISC SUPPORT SECTION ##########################\n"
2638 case RC_AUTO_NUMBER:
2639 if (ignore_system_lyxrc ||
2640 auto_number != system_lyxrc.auto_number) {
2641 os << "\\auto_number " << convert<string>(auto_number) << '\n';
2646 case RC_GUI_LANGUAGE:
2647 if (ignore_system_lyxrc ||
2648 gui_language != system_lyxrc.gui_language) {
2649 os << "\\gui_language " << gui_language << '\n';
2654 case RC_EXPORT_OVERWRITE:
2655 if (ignore_system_lyxrc ||
2656 export_overwrite != system_lyxrc.export_overwrite) {
2658 switch (export_overwrite) {
2669 os << "\\export_overwrite " << status << '\n';
2674 case RC_SCROLL_WHEEL_ZOOM:
2675 if (ignore_system_lyxrc ||
2676 scroll_wheel_zoom != system_lyxrc.scroll_wheel_zoom) {
2678 switch (scroll_wheel_zoom) {
2679 case SCROLL_WHEEL_ZOOM_OFF:
2682 case SCROLL_WHEEL_ZOOM_CTRL:
2685 case SCROLL_WHEEL_ZOOM_SHIFT:
2688 case SCROLL_WHEEL_ZOOM_ALT:
2692 os << "\\scroll_wheel_zoom " << status << '\n';
2698 << "# FORMATS SECTION ##########################\n"
2703 // New/modified formats
2704 for (Formats::const_iterator cit = theFormats().begin();
2705 cit != theFormats().end(); ++cit) {
2706 Format const * format =
2707 theSystemFormats().getFormat(cit->name());
2709 format->extensions() != cit->extensions() ||
2710 format->prettyname() != cit->prettyname() ||
2711 format->shortcut() != cit->shortcut() ||
2712 format->viewer() != cit->viewer() ||
2713 format->editor() != cit->editor() ||
2714 format->documentFormat() != cit->documentFormat() ||
2715 format->vectorFormat() != cit->vectorFormat() ||
2716 format->inExportMenu() != cit->inExportMenu() ||
2717 format->noMenu() != cit->noMenu() ||
2718 format->mime() != cit->mime()) {
2719 os << "\\format \"" << cit->name() << "\" \""
2720 << cit->extensions() << "\" \""
2721 << to_utf8(cit->prettyname()) << "\" \""
2722 << cit->shortcut() << "\" \""
2723 << escapeCommand(cit->viewer()) << "\" \""
2724 << escapeCommand(cit->editor()) << "\" \"";
2725 vector<string> flags;
2726 if (cit->documentFormat())
2727 flags.push_back("document");
2728 if (cit->vectorFormat())
2729 flags.push_back("vector");
2730 if (cit->zippedNative())
2731 flags.push_back("zipped=native");
2732 if (cit->inExportMenu())
2733 flags.push_back("menu=export");
2735 os << getStringFromVector(flags);
2736 os << "\" \"" << cit->mime() << "\"\n";
2740 // Look for deleted formats
2741 for (Formats::const_iterator cit = theSystemFormats().begin();
2742 cit != theSystemFormats().end(); ++cit)
2743 if (!theFormats().getFormat(cit->name()))
2744 os << "\\format \"" << cit->name()
2745 << "\" \"\" \"\" \"\" \"\" \"\" \"\" \"\"\n";
2749 case RC_VIEWER_ALTERNATIVES: {
2750 Alternatives::const_iterator it = viewer_alternatives.begin();
2751 Alternatives::const_iterator const en = viewer_alternatives.end();
2752 Alternatives::const_iterator const sysend =
2753 system_lyxrc.viewer_alternatives.end();
2754 for (; it != en; ++it) {
2755 string const & fmt = it->first;
2756 CommandSet const & cmd = it->second;
2757 CommandSet::const_iterator sit = cmd.begin();
2758 CommandSet::const_iterator const sen = cmd.end();
2759 Alternatives::const_iterator const sysfmt = ignore_system_lyxrc ?
2760 system_lyxrc.viewer_alternatives.begin() : // we won't use it in this case
2761 system_lyxrc.viewer_alternatives.find(fmt);
2762 for (; sit != sen; ++sit) {
2763 string const & cmd = *sit;
2764 if (ignore_system_lyxrc
2765 || sysfmt == sysend // format not found
2766 || sysfmt->second.count(cmd) == 0 // this command not found
2768 os << "\\viewer_alternatives " << fmt << " \"" << escapeCommand(cmd) << "\"\n";
2775 case RC_EDITOR_ALTERNATIVES: {
2776 Alternatives::const_iterator it = editor_alternatives.begin();
2777 Alternatives::const_iterator const en = editor_alternatives.end();
2778 Alternatives::const_iterator const sysend =
2779 system_lyxrc.editor_alternatives.end();
2780 for (; it != en; ++it) {
2781 string const & fmt = it->first;
2782 CommandSet const & cmd = it->second;
2783 CommandSet::const_iterator sit = cmd.begin();
2784 CommandSet::const_iterator const sen = cmd.end();
2785 Alternatives::const_iterator const sysfmt = ignore_system_lyxrc ?
2786 system_lyxrc.editor_alternatives.begin() : // we won't use it in this case
2787 system_lyxrc.editor_alternatives.find(fmt);
2788 for (; sit != sen; ++sit) {
2789 string const & cmd = *sit;
2790 if (ignore_system_lyxrc
2791 || sysfmt == sysend // format not found
2792 || sysfmt->second.count(cmd) == 0 // this command not found
2794 os << "\\editor_alternatives " << fmt << " \"" << escapeCommand(cmd) << "\"\n";
2801 case RC_DEFAULT_OTF_VIEW_FORMAT:
2802 if ((ignore_system_lyxrc ||
2803 default_otf_view_format != system_lyxrc.default_otf_view_format)
2804 && !default_otf_view_format.empty()) {
2805 os << "\\default_otf_view_format " << default_otf_view_format << '\n';
2810 case RC_DEFAULT_PLATEX_VIEW_FORMAT:
2811 if ((ignore_system_lyxrc ||
2812 default_platex_view_format != system_lyxrc.default_platex_view_format)
2813 && !default_platex_view_format.empty()) {
2814 os << "\\default_platex_view_format " << default_platex_view_format << '\n';
2819 case RC_DEFAULT_VIEW_FORMAT:
2820 if ((ignore_system_lyxrc ||
2821 default_view_format != system_lyxrc.default_view_format)
2822 && !default_view_format.empty()) {
2823 os << "\\default_view_format " << default_view_format << '\n';
2834 << "# CONVERTERS SECTION ##########################\n"
2839 // Look for new converters
2840 for (Converters::const_iterator cit = theConverters().begin();
2841 cit != theConverters().end(); ++cit) {
2842 Converter const * converter =
2843 theSystemConverters().getConverter(cit->from(),
2846 converter->command() != cit->command() ||
2847 converter->flags() != cit->flags())
2848 os << "\\converter \"" << cit->from() << "\" \""
2849 << cit->to() << "\" \""
2850 << escapeCommand(cit->command()) << "\" \""
2851 << cit->flags() << "\"\n";
2854 // New/modifed converters
2855 for (Converters::const_iterator cit = theSystemConverters().begin();
2856 cit != theSystemConverters().end(); ++cit)
2857 if (!theConverters().getConverter(cit->from(), cit->to()))
2858 os << "\\converter \"" << cit->from()
2859 << "\" \"" << cit->to() << "\" \"\" \"\"\n";
2866 << "# COPIERS SECTION ##########################\n"
2869 // Look for new movers
2870 Movers::const_iterator const sysbegin = theSystemMovers().begin();
2871 Movers::const_iterator const sysend = theSystemMovers().end();
2872 Movers::const_iterator it = theMovers().begin();
2873 Movers::const_iterator end = theMovers().end();
2875 for (; it != end; ++it) {
2876 Movers::const_iterator const sysit =
2877 find_if(sysbegin, sysend, SameMover(*it));
2878 if (sysit == sysend) {
2879 string const & fmt = it->first;
2880 string const & command =
2881 it->second.command();
2883 os << "\\copier " << fmt
2884 << " \"" << escapeCommand(command) << "\"\n";
2890 // We don't actually delete SpecialisedMover(s) from the
2891 // map, just clear their 'command', so there's no need
2892 // to test for anything else.
2899 void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new)
2901 // Why the switch you might ask. It is a trick to ensure that all
2902 // the elements in the LyXRCTags enum is handled. As you can see
2903 // there are no breaks at all. So it is just a huge fall-through.
2904 // The nice thing is that we will get a warning from the compiler
2905 // if we forget an element.
2906 LyXRC::LyXRCTags tag = LyXRC::RC_LAST;
2908 case LyXRC::RC_LAST:
2909 case LyXRC::RC_ACCEPT_COMPOUND:
2910 if (lyxrc_orig.spellchecker_accept_compound != lyxrc_new.spellchecker_accept_compound)
2911 if (theSpellChecker()) theSpellChecker()->advanceChangeNumber();
2913 case LyXRC::RC_ALT_LANG:
2914 case LyXRC::RC_PLAINTEXT_LINELEN:
2915 case LyXRC::RC_AUTOCORRECTION_MATH:
2916 case LyXRC::RC_AUTOREGIONDELETE:
2917 case LyXRC::RC_AUTORESET_OPTIONS:
2918 case LyXRC::RC_AUTOSAVE:
2919 case LyXRC::RC_AUTO_NUMBER:
2920 case LyXRC::RC_BACKUPDIR_PATH:
2921 case LyXRC::RC_BIBTEX_ALTERNATIVES:
2922 case LyXRC::RC_BIBTEX_COMMAND:
2923 case LyXRC::RC_BINDFILE:
2924 case LyXRC::RC_BOOKMARKS_VISIBILITY:
2925 case LyXRC::RC_CITATION_SEARCH:
2926 case LyXRC::RC_CITATION_SEARCH_PATTERN:
2927 case LyXRC::RC_CITATION_SEARCH_VIEW:
2928 case LyXRC::RC_CHECKLASTFILES:
2929 case LyXRC::RC_COMPLETION_CURSOR_TEXT:
2930 case LyXRC::RC_COMPLETION_INLINE_DELAY:
2931 case LyXRC::RC_COMPLETION_INLINE_DOTS:
2932 case LyXRC::RC_COMPLETION_INLINE_MATH:
2933 case LyXRC::RC_COMPLETION_INLINE_TEXT:
2934 case LyXRC::RC_COMPLETION_POPUP_AFTER_COMPLETE:
2935 case LyXRC::RC_COMPLETION_POPUP_DELAY:
2936 case LyXRC::RC_COMPLETION_POPUP_MATH:
2937 case LyXRC::RC_COMPLETION_POPUP_TEXT:
2938 case LyXRC::RC_COMPLETION_MINLENGTH:
2939 case LyXRC::RC_USELASTFILEPOS:
2940 case LyXRC::RC_LOADSESSION:
2941 case LyXRC::RC_CHKTEX_COMMAND:
2942 case LyXRC::RC_CONVERTER:
2943 case LyXRC::RC_CONVERTER_CACHE_MAXAGE:
2944 case LyXRC::RC_COPIER:
2945 case LyXRC::RC_CT_ADDITIONS_UNDERLINED:
2946 case LyXRC::RC_CT_MARKUP_COPIED:
2947 case LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR:
2948 case LyXRC::RC_SCROLL_BELOW_DOCUMENT:
2949 case LyXRC::RC_GUI_LANGUAGE:
2950 case LyXRC::RC_DEFAULT_OTF_VIEW_FORMAT:
2951 case LyXRC::RC_DEFAULT_PLATEX_VIEW_FORMAT:
2952 case LyXRC::RC_DEFAULT_VIEW_FORMAT:
2953 case LyXRC::RC_DEFFILE:
2954 case LyXRC::RC_DIALOGS_ICONIFY_WITH_MAIN:
2955 case LyXRC::RC_DISPLAY_GRAPHICS:
2956 case LyXRC::RC_DOCUMENTPATH:
2957 if (lyxrc_orig.document_path != lyxrc_new.document_path) {
2958 FileName path(lyxrc_new.document_path);
2959 if (path.exists() && path.isDirectory())
2960 package().document_dir() = FileName(lyxrc.document_path);
2963 case LyXRC::RC_DRAW_STRATEGY:
2964 case LyXRC::RC_EDITOR_ALTERNATIVES:
2965 case LyXRC::RC_ESC_CHARS:
2966 case LyXRC::RC_EXAMPLEPATH:
2967 case LyXRC::RC_FILEFORMAT:
2968 case LyXRC::RC_GROUP_LAYOUTS:
2969 case LyXRC::RC_HUNSPELLDIR_PATH:
2970 case LyXRC::RC_ICON_SET:
2971 case LyXRC::RC_UI_STYLE:
2972 case LyXRC::RC_INDEX_ALTERNATIVES:
2973 case LyXRC::RC_INDEX_COMMAND:
2974 case LyXRC::RC_JBIBTEX_COMMAND:
2975 case LyXRC::RC_JBIBTEX_ALTERNATIVES:
2976 case LyXRC::RC_JINDEX_COMMAND:
2977 case LyXRC::RC_NOMENCL_COMMAND:
2978 case LyXRC::RC_PYGMENTIZE_COMMAND:
2979 case LyXRC::RC_INPUT:
2980 case LyXRC::RC_KBMAP:
2981 case LyXRC::RC_KBMAP_PRIMARY:
2982 case LyXRC::RC_KBMAP_SECONDARY:
2983 case LyXRC::RC_LANGUAGE_AUTO_BEGIN:
2984 case LyXRC::RC_LANGUAGE_AUTO_END:
2985 case LyXRC::RC_LANGUAGE_COMMAND_BEGIN:
2986 case LyXRC::RC_LANGUAGE_COMMAND_END:
2987 case LyXRC::RC_LANGUAGE_COMMAND_LOCAL:
2988 case LyXRC::RC_LANGUAGE_GLOBAL_OPTIONS:
2989 case LyXRC::RC_LANGUAGE_CUSTOM_PACKAGE:
2990 case LyXRC::RC_LANGUAGE_PACKAGE_SELECTION:
2991 case LyXRC::RC_LYXRCFORMAT:
2992 case LyXRC::RC_MAC_DONTSWAP_CTRL_META:
2993 case LyXRC::RC_MAC_LIKE_CURSOR_MOVEMENT:
2994 case LyXRC::RC_MACRO_EDIT_STYLE:
2995 case LyXRC::RC_MAKE_BACKUP:
2996 case LyXRC::RC_MARK_FOREIGN_LANGUAGE:
2997 case LyXRC::RC_RESPECT_OS_KBD_LANGUAGE:
2998 case LyXRC::RC_MOUSE_WHEEL_SPEED:
2999 case LyXRC::RC_MOUSE_MIDDLEBUTTON_PASTE:
3000 case LyXRC::RC_NUMLASTFILES:
3001 case LyXRC::RC_PARAGRAPH_MARKERS:
3002 case LyXRC::RC_PATH_PREFIX:
3003 if (lyxrc_orig.path_prefix != lyxrc_new.path_prefix) {
3004 prependEnvPath("PATH", replaceEnvironmentPath(lyxrc_new.path_prefix));
3005 // Resets python path
3006 support::os::python(true);
3009 case LyXRC::RC_PREVIEW:
3010 if (lyxrc_orig.preview != lyxrc_new.preview) {
3011 // Update all previews of all documents.
3012 /* FIXME: this can be very expensive. It would be cheaper
3013 * to kill all existing previews and update visible
3015 theBufferList().updatePreviews();
3018 case LyXRC::RC_PREVIEW_HASHED_LABELS:
3019 case LyXRC::RC_PREVIEW_SCALE_FACTOR:
3020 case LyXRC::RC_PRINTLANDSCAPEFLAG:
3021 case LyXRC::RC_PRINTPAPERDIMENSIONFLAG:
3022 case LyXRC::RC_PRINTPAPERFLAG:
3023 case LyXRC::RC_SAVE_COMPRESSED:
3024 case LyXRC::RC_SAVE_ORIGIN:
3025 case LyXRC::RC_SCREEN_DPI:
3027 case LyXRC::RC_SCREEN_FONT_ROMAN:
3028 case LyXRC::RC_SCREEN_FONT_ROMAN_FOUNDRY:
3029 case LyXRC::RC_SCREEN_FONT_SANS:
3030 case LyXRC::RC_SCREEN_FONT_SANS_FOUNDRY:
3031 case LyXRC::RC_SCREEN_FONT_SCALABLE:
3032 case LyXRC::RC_SCREEN_FONT_SIZES:
3033 case LyXRC::RC_SCREEN_FONT_TYPEWRITER:
3034 case LyXRC::RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
3035 case LyXRC::RC_SCREEN_ZOOM:
3036 if (lyxrc_orig.roman_font_name != lyxrc_new.roman_font_name
3037 || lyxrc_orig.sans_font_name != lyxrc_new.sans_font_name
3038 || lyxrc_orig.typewriter_font_name != lyxrc_new.typewriter_font_name
3039 || lyxrc_orig.roman_font_foundry != lyxrc_new.roman_font_foundry
3040 || lyxrc_orig.sans_font_foundry != lyxrc_new.sans_font_foundry
3041 || lyxrc_orig.use_scalable_fonts != lyxrc_new.use_scalable_fonts
3042 || !std::equal(std::begin(lyxrc_orig.font_sizes), std::end(lyxrc_orig.font_sizes),
3043 std::begin(lyxrc_new.font_sizes))
3044 || lyxrc_orig.typewriter_font_foundry != lyxrc_new.typewriter_font_foundry
3045 || lyxrc_orig.defaultZoom != lyxrc_new.defaultZoom) {
3046 dispatch(FuncRequest(LFUN_SCREEN_FONT_UPDATE));
3049 case LyXRC::RC_GEOMETRY_SESSION:
3050 case LyXRC::RC_SERVERPIPE:
3051 case LyXRC::RC_SET_COLOR:
3052 case LyXRC::RC_SHOW_BANNER:
3053 case LyXRC::RC_OPEN_BUFFERS_IN_TABS:
3054 case LyXRC::RC_SPELLCHECKER:
3055 if (lyxrc_orig.spellchecker != lyxrc_new.spellchecker)
3058 case LyXRC::RC_SPELLCHECK_CONTINUOUSLY:
3059 case LyXRC::RC_SPELLCHECK_NOTES:
3060 case LyXRC::RC_SPLITINDEX_COMMAND:
3061 case LyXRC::RC_TEMPDIRPATH:
3062 case LyXRC::RC_TEMPLATEPATH:
3063 case LyXRC::RC_TEX_ALLOWS_SPACES:
3064 case LyXRC::RC_TEX_EXPECTS_WINDOWS_PATHS:
3065 if (lyxrc_orig.windows_style_tex_paths != lyxrc_new.windows_style_tex_paths) {
3066 os::windows_style_tex_paths(lyxrc_new.windows_style_tex_paths);
3069 case LyXRC::RC_TEXINPUTS_PREFIX:
3070 case LyXRC::RC_THESAURUSDIRPATH:
3071 case LyXRC::RC_UIFILE:
3072 case LyXRC::RC_USER_EMAIL:
3073 case LyXRC::RC_USER_INITIALS:
3074 case LyXRC::RC_USER_NAME:
3075 case LyXRC::RC_USE_CONVERTER_CACHE:
3076 case LyXRC::RC_USE_CONVERTER_NEEDAUTH_FORBIDDEN:
3077 case LyXRC::RC_USE_CONVERTER_NEEDAUTH:
3078 case LyXRC::RC_USE_NATIVE_FILEDIALOG:
3079 case LyXRC::RC_USE_SYSTEM_COLORS:
3080 case LyXRC::RC_USE_TOOLTIP:
3081 case LyXRC::RC_USE_SYSTEM_THEME_ICONS:
3082 case LyXRC::RC_VIEWDVI_PAPEROPTION:
3083 case LyXRC::RC_SINGLE_CLOSE_TAB_BUTTON:
3084 case LyXRC::RC_SINGLE_INSTANCE:
3085 case LyXRC::RC_SORT_LAYOUTS:
3086 case LyXRC::RC_SCREEN_LIMIT:
3087 case LyXRC::RC_FULL_SCREEN_SCROLLBAR:
3088 case LyXRC::RC_FULL_SCREEN_MENUBAR:
3089 case LyXRC::RC_FULL_SCREEN_STATUSBAR:
3090 case LyXRC::RC_FULL_SCREEN_TABBAR:
3091 case LyXRC::RC_FULL_SCREEN_TOOLBARS:
3092 case LyXRC::RC_SCREEN_WIDTH:
3093 case LyXRC::RC_VISUAL_CURSOR:
3094 case LyXRC::RC_CLOSE_BUFFER_WITH_LAST_VIEW:
3095 case LyXRC::RC_VIEWER:
3096 case LyXRC::RC_VIEWER_ALTERNATIVES:
3097 case LyXRC::RC_FORWARD_SEARCH_DVI:
3098 case LyXRC::RC_FORWARD_SEARCH_PDF:
3099 case LyXRC::RC_EXPORT_OVERWRITE:
3100 case LyXRC::RC_DEFAULT_DECIMAL_SEP:
3101 case LyXRC::RC_DEFAULT_LENGTH_UNIT:
3102 case LyXRC::RC_SCROLL_WHEEL_ZOOM:
3103 case LyXRC::RC_CURSOR_WIDTH:
3109 set<string> LyXRC::getRCs()
3112 for (int i = 0; i != lyxrcCount; ++i)
3113 res.insert(ltrim(lyxrcTags[i].tag, "\\"));
3119 string const LyXRC::getDescription(LyXRCTags tag)
3124 case RC_ACCEPT_COMPOUND:
3125 str = _("Consider run-together words, such as \"diskdrive\" for \"disk drive\", as legal words?");
3129 str = _("Specify an alternate language. The default is to use the language of the document.");
3132 case RC_PLAINTEXT_LINELEN:
3133 str = _("The maximum line length of exported plain text/LaTeX/SGML files. If set to 0, paragraphs are output in a single line; if the line length is > 0, paragraphs are separated by a blank line.");
3136 case RC_AUTOREGIONDELETE:
3137 str = _("De-select if you don't want the current selection to be replaced automatically by what you type.");
3140 case RC_AUTORESET_OPTIONS:
3141 str = _("De-select if you don't want the class options to be reset to defaults after class change.");
3145 str = _("The time interval between auto-saves (in seconds). 0 means no auto-save.");
3148 case RC_AUTO_NUMBER:
3151 case RC_BACKUPDIR_PATH:
3152 str = _("The path for storing backup files. If it is an empty string, LyX will store the backup file in the same directory as the original file.");
3155 case RC_BIBTEX_COMMAND:
3156 str = _("Define the options of bibtex (cf. man bibtex) or select an alternative compiler (e.g. mlbibtex or bibulus).");
3159 case RC_JBIBTEX_COMMAND:
3160 str = _("Define the options of the bibtex program for PLaTeX (Japanese LaTeX).");
3164 str = _("Keybindings file. Can either specify an absolute path, or LyX will look in its global and local bind/ directories.");
3167 case RC_CHECKLASTFILES:
3168 str = _("Select to check whether the lastfiles still exist.");
3171 case RC_CHKTEX_COMMAND:
3172 str = _("Define how to run chktex. E.g. \"chktex -n11 -n1 -n3 -n6 -n9 -22 -n25 -n30 -n38\" Refer to the ChkTeX documentation.");
3178 case RC_CONVERTER_NEEDAUTH_FORBIDDEN:
3179 str = _("Forbid use of external converters with 'needauth' option to prevent undesired effects.");
3182 case RC_CONVERTER_NEEDAUTH:
3183 str = _("Ask user before calling external converters with 'needauth' option to prevent undesired effects.");
3189 case RC_CURSOR_FOLLOWS_SCROLLBAR:
3190 str = _("LyX normally doesn't update the cursor position if you move the scrollbar. Set to true if you'd prefer to always have the cursor on screen.");
3193 case RC_CURSOR_WIDTH:
3194 str = _("Configure the width of the text cursor. Automatic zoom-controlled cursor width used when set to 0.");
3197 case RC_SCROLL_BELOW_DOCUMENT:
3198 str = _("LyX normally doesn't allow the user to scroll further than the bottom of the document. Set to true if you prefer to scroll the bottom of the document to the top of the screen");
3201 case RC_MAC_DONTSWAP_CTRL_META:
3202 str = _("Make Apple key act as Meta and Control key as Ctrl.");
3205 case RC_MAC_LIKE_CURSOR_MOVEMENT:
3206 str = _("Use the Mac OS X conventions for cursor movement");
3209 case RC_SHOW_MACRO_LABEL:
3210 str = _("Show a small box around a Math Macro with the macro name when the cursor is inside.");
3214 str = _("Command definition file. Can either specify an absolute path, or LyX will look in its global and local commands/ directories.");
3217 case RC_DEFAULT_OTF_VIEW_FORMAT:
3218 str = _("The default format used with LFUN_BUFFER_[VIEW|UPDATE] with non-TeX fonts.");
3221 case RC_DEFAULT_VIEW_FORMAT:
3222 str = _("The default format used with LFUN_BUFFER_[VIEW|UPDATE].");
3225 case RC_DIALOGS_ICONIFY_WITH_MAIN:
3226 str = _("Iconify the dialogs when the main window is iconified. (Affects only dialogs shown after the change has been made.)");
3229 case RC_DISPLAY_GRAPHICS:
3230 str = _("Select how LyX will display any graphics.");
3233 case RC_DOCUMENTPATH:
3234 str = _("The default path for your documents. An empty value selects the directory LyX was started from.");
3238 str = _("Specify additional chars that can be part of a word.");
3241 case RC_EXAMPLEPATH:
3242 str = _("The path that LyX will set when offering to choose an example. An empty value selects the directory LyX was started from.");
3248 case RC_INDEX_COMMAND:
3249 str = _("Define the options of makeindex (cf. man makeindex) or select an alternative compiler. E.g., using xindy/make-rules, the command string would be \"makeindex.sh -m $$lang\".");
3252 case RC_JINDEX_COMMAND:
3253 str = _("Define the options of the index program for PLaTeX (Japanese LaTeX).");
3256 case RC_NOMENCL_COMMAND:
3257 str = _("Define the options of makeindex (cf. man makeindex) to be used for nomenclatures. This might differ from the index processing options.");
3260 case RC_PYGMENTIZE_COMMAND:
3261 str = _("The command to run the python pygments syntax highlighter.");
3268 case RC_KBMAP_PRIMARY:
3269 case RC_KBMAP_SECONDARY:
3270 str = _("Use this to set the correct mapping file for your keyboard. You'll need this if you for instance want to type German documents on an American keyboard.");
3273 case RC_LANGUAGE_AUTO_BEGIN:
3274 str = _("Select if a language switching command is needed at the beginning of the document.");
3277 case RC_LANGUAGE_AUTO_END:
3278 str = _("Select if a language switching command is needed at the end of the document.");
3281 case RC_LANGUAGE_COMMAND_BEGIN:
3282 str = _("The LaTeX command for changing from the language of the document to another language. E.g. \\selectlanguage{$$lang} where $$lang is substituted by the name of the second language.");
3285 case RC_LANGUAGE_COMMAND_END:
3286 str = _("The LaTeX command for changing back to the language of the document.");
3289 case RC_LANGUAGE_COMMAND_LOCAL:
3290 str = _("The LaTeX command for local changing of the language.");
3293 case RC_LANGUAGE_GLOBAL_OPTIONS:
3294 str = _("De-select if you don't want the language(s) used as an argument to \\documentclass.");
3297 case RC_LANGUAGE_CUSTOM_PACKAGE:
3298 str = _("The LaTeX command for loading the language package. E.g. \"\\usepackage{babel}\", \"\\usepackage{omega}\".");
3301 case RC_LANGUAGE_PACKAGE_SELECTION:
3302 str = _("De-select if you don't want babel to be used when the language of the document is the default language.");
3305 case RC_USELASTFILEPOS:
3306 str = _("De-select if you do not want LyX to scroll to saved position.");
3309 case RC_LOADSESSION:
3310 str = _("De-select to prevent loading files opened from the last LyX session.");
3313 case RC_MAKE_BACKUP:
3314 str = _("De-select if you don't want LyX to create backup files.");
3317 case RC_MARK_FOREIGN_LANGUAGE:
3318 str = _("Select to control the highlighting of words with a language foreign to that of the document.");
3321 case RC_RESPECT_OS_KBD_LANGUAGE:
3322 str = _("Select to use the current keyboard language, as set from the operating system, as default input language.");
3325 case RC_MOUSE_WHEEL_SPEED:
3326 str = _("The scrolling speed of the mouse wheel.");
3329 case RC_COMPLETION_POPUP_DELAY:
3330 str = _("The completion popup delay.");
3333 case RC_COMPLETION_POPUP_MATH:
3334 str = _("Select to display the completion popup in math mode.");
3337 case RC_COMPLETION_POPUP_TEXT:
3338 str = _("Select to display the completion popup in text mode.");
3341 case RC_COMPLETION_POPUP_AFTER_COMPLETE:
3342 str = _("Show the completion popup without delay after non-unique completion attempt.");
3345 case RC_COMPLETION_POPUP_TEXT:
3346 str = _("Show a small triangle on the cursor to indicate that a completion is available.");
3349 case RC_COMPLETION_POPUP_DELAY:
3350 str = _("The inline completion delay.");
3353 case RC_COMPLETION_INLINE_MATH:
3354 str = _("Select to display the inline completion in math mode.");
3357 case RC_COMPLETION_INLINE_TEXT:
3358 str = _("Select to display the inline completion in text mode.");
3361 case RC_COMPLETION_INLINE_DOTS:
3362 str = _("Use \"...\" to shorten long completions.");
3365 case RC_AUTOCORRECTION_MATH:
3366 str = _("Allow TeXMacs shorthand, like => converting to \\Rightarrow.");
3369 case RC_NUMLASTFILES:
3370 str = bformat(_("Maximal number of lastfiles. Up to %1$d can appear in the file menu."),
3374 case RC_PATH_PREFIX:
3375 str = _("Specify those directories which should be "
3376 "prepended to the PATH environment variable.\n"
3377 "Use the OS native format.");
3381 str = _("Shows a typeset preview of things such as math");
3384 case RC_PREVIEW_HASHED_LABELS:
3385 str = _("Previewed equations will have \"(#)\" labels rather than numbered ones");
3388 case RC_PREVIEW_SCALE_FACTOR:
3389 str = _("Scale the preview size to suit.");
3392 case RC_PRINTLANDSCAPEFLAG:
3393 str = _("The option to print out in landscape.");
3396 case RC_PRINTPAPERDIMENSIONFLAG:
3397 str = _("Option to specify the dimensions of the print paper.");
3400 case RC_PRINTPAPERFLAG:
3401 str = _("The option to specify paper type.");
3404 case RC_VISUAL_CURSOR:
3405 str = _("Select to have visual bidi cursor movement, unselect for logical movement.");
3408 case RC_CLOSE_BUFFER_WITH_LAST_VIEW:
3409 str = _("Specify whether, closing the last view of an open document, LyX should close the document (yes), hide it (no), or ask the user (ask).");
3413 str = _("DPI (dots per inch) of your monitor is auto-detected by LyX. If that goes wrong, override the setting here.");
3416 case RC_SCREEN_FONT_ROMAN:
3417 case RC_SCREEN_FONT_SANS:
3418 case RC_SCREEN_FONT_TYPEWRITER:
3419 str = _("The screen fonts used to display the text while editing.");
3422 case RC_SCREEN_FONT_ROMAN_FOUNDRY:
3423 case RC_SCREEN_FONT_SANS_FOUNDRY:
3424 case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
3427 case RC_SCREEN_FONT_SCALABLE:
3428 str = _("Allow bitmap fonts to be resized. If you are using a bitmap font, selecting this option may make some fonts look blocky in LyX. Deselecting this option makes LyX use the nearest bitmap font size available, instead of scaling.");
3431 case RC_SCREEN_FONT_SIZES:
3432 str = _("The font sizes used for calculating the scaling of the screen fonts.");
3435 case RC_SCREEN_ZOOM:
3436 //xgettext:no-c-format
3437 str = _("The zoom percentage for screen fonts. A setting of 100% will make the fonts roughly the same size as on paper.");
3440 case RC_GEOMETRY_SESSION:
3441 str = _("Allow session manager to save and restore windows geometry.");
3445 str = _("This starts the lyxserver. The pipes get an additional extension \".in\" and \".out\". Only for advanced users.");
3451 case RC_SHOW_BANNER:
3452 str = _("De-select if you don't want the startup banner.");
3455 case RC_TEMPDIRPATH:
3456 str = _("LyX will place its temporary directories in this path. They will be deleted when you quit LyX.");
3459 case RC_THESAURUSDIRPATH:
3460 str = _("This is the place where the files of the thesaurus library reside.");
3463 case RC_TEMPLATEPATH:
3464 str = _("The path that LyX will set when offering to choose a template. An empty value selects the directory LyX was started from.");
3467 case RC_TEX_ALLOWS_SPACES:
3470 case RC_TEX_EXPECTS_WINDOWS_PATHS:
3473 case RC_TEXINPUTS_PREFIX:
3474 str = _("Specify those directories which should be "
3475 "prepended to the TEXINPUTS environment variable.\n"
3476 "A '.' represents the current document directory. "
3477 "Use the OS native format.");
3481 str = _("The UI (user interface) file. Can either specify an absolute path, or LyX will look in its global and local ui/ directories.");
3490 case RC_USE_USE_SYSTEM_COLORS:
3491 str = _("Enable use the system colors for some things like main window background and selection.");
3494 case RC_USE_TOOLTIP:
3495 str = _("Enable the automatic appearance of tool tips in the work area.");
3498 case RC_VIEWDVI_PAPEROPTION:
3499 _("Specify the paper command to DVI viewer (leave empty or use \"-paper\")");
3514 // The global instance
3517 // The global copy of the system lyxrc entries (everything except preferences)