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"
31 #include "SpellChecker.h"
34 #include "support/convert.h"
35 #include "support/debug.h"
36 #include "support/environment.h"
37 #include "support/FileName.h"
38 #include "support/filetools.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 = 36; // rkh: spellcheck_continuously default
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 { "\\editor_alternatives", LyXRC::RC_EDITOR_ALTERNATIVES },
111 { "\\escape_chars", LyXRC::RC_ESC_CHARS },
112 { "\\example_path", LyXRC::RC_EXAMPLEPATH },
113 { "\\export_overwrite", LyXRC::RC_EXPORT_OVERWRITE },
114 { "\\format", LyXRC::RC_FILEFORMAT },
115 { "\\forward_search_dvi", LyXRC::RC_FORWARD_SEARCH_DVI },
116 { "\\forward_search_pdf", LyXRC::RC_FORWARD_SEARCH_PDF },
117 { "\\fullscreen_limit", LyXRC::RC_FULL_SCREEN_LIMIT },
118 { "\\fullscreen_menubar", LyXRC::RC_FULL_SCREEN_MENUBAR },
119 { "\\fullscreen_scrollbar", LyXRC::RC_FULL_SCREEN_SCROLLBAR },
120 { "\\fullscreen_statusbar", LyXRC::RC_FULL_SCREEN_STATUSBAR },
121 { "\\fullscreen_tabbar", LyXRC::RC_FULL_SCREEN_TABBAR },
122 { "\\fullscreen_toolbars", LyXRC::RC_FULL_SCREEN_TOOLBARS },
123 { "\\fullscreen_width", LyXRC::RC_FULL_SCREEN_WIDTH },
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_zoom", LyXRC::RC_SCREEN_ZOOM },
179 { "\\scroll_below_document", LyXRC::RC_SCROLL_BELOW_DOCUMENT },
180 { "\\scroll_wheel_zoom", LyXRC::RC_SCROLL_WHEEL_ZOOM },
181 { "\\serverpipe", LyXRC::RC_SERVERPIPE },
182 { "\\set_color", LyXRC::RC_SET_COLOR },
183 { "\\show_banner", LyXRC::RC_SHOW_BANNER },
184 { "\\single_close_tab_button", LyXRC::RC_SINGLE_CLOSE_TAB_BUTTON },
185 { "\\single_instance", LyXRC::RC_SINGLE_INSTANCE },
186 { "\\sort_layouts", LyXRC::RC_SORT_LAYOUTS },
187 { "\\spellcheck_continuously", LyXRC::RC_SPELLCHECK_CONTINUOUSLY },
188 { "\\spellcheck_notes", LyXRC::RC_SPELLCHECK_NOTES },
189 { "\\spellchecker", LyXRC::RC_SPELLCHECKER },
190 { "\\splitindex_command", LyXRC::RC_SPLITINDEX_COMMAND },
191 { "\\tempdir_path", LyXRC::RC_TEMPDIRPATH },
192 { "\\template_path", LyXRC::RC_TEMPLATEPATH },
193 { "\\tex_allows_spaces", LyXRC::RC_TEX_ALLOWS_SPACES },
194 { "\\tex_expects_windows_paths", LyXRC::RC_TEX_EXPECTS_WINDOWS_PATHS },
195 { "\\texinputs_prefix", LyXRC::RC_TEXINPUTS_PREFIX },
196 { "\\thesaurusdir_path", LyXRC::RC_THESAURUSDIRPATH },
197 { "\\ui_file", LyXRC::RC_UIFILE },
198 { "\\use_converter_cache", LyXRC::RC_USE_CONVERTER_CACHE },
199 { "\\use_converter_needauth", LyXRC::RC_USE_CONVERTER_NEEDAUTH },
200 { "\\use_converter_needauth_forbidden", LyXRC::RC_USE_CONVERTER_NEEDAUTH_FORBIDDEN },
201 { "\\use_lastfilepos", LyXRC::RC_USELASTFILEPOS },
202 { "\\use_native_filedialog", LyXRC::RC_USE_NATIVE_FILEDIALOG },
203 // compatibility with versions older than 1.4.0 only
204 { "\\use_system_colors", LyXRC::RC_USE_SYSTEM_COLORS },
205 { "\\use_system_theme_icons", LyXRC::RC_USE_SYSTEM_THEME_ICONS },
206 { "\\use_tooltip", LyXRC::RC_USE_TOOLTIP },
207 { "\\user_email", LyXRC::RC_USER_EMAIL },
208 { "\\user_initials", LyXRC::RC_USER_INITIALS },
209 { "\\user_name", LyXRC::RC_USER_NAME },
210 { "\\view_dvi_paper_option", LyXRC::RC_VIEWDVI_PAPEROPTION },
211 // compatibility with versions older than 1.4.0 only
212 { "\\viewer", LyXRC::RC_VIEWER},
213 { "\\viewer_alternatives", LyXRC::RC_VIEWER_ALTERNATIVES },
214 { "\\visual_cursor", LyXRC::RC_VISUAL_CURSOR },
215 { "format", LyXRC::RC_LYXRCFORMAT }
218 const int lyxrcCount = sizeof(lyxrcTags) / sizeof(lyxrcTags[0]);
221 void oldFontFormat(string & family, string & foundry)
223 if (family.empty() || family[0] != '-')
225 foundry = token(family, '-', 1);
226 family = token(family, '-', 2);
234 bool LyXRC::read(FileName const & filename, bool check_format)
236 Lexer lexrc(lyxrcTags);
237 lexrc.setFile(filename);
238 LYXERR(Debug::LYXRC, "Reading '" << filename << "'...");
239 ReturnValues retval = read(lexrc, check_format);
240 if (!check_format || retval != FormatMismatch)
241 return retval == ReadOK;
243 LYXERR(Debug::FILES, "Converting LyXRC file to " << LYXRC_FILEFORMAT);
244 TempFile tmp("convert_lyxrc");
245 FileName const tempfile = tmp.name();
246 bool const success = prefs2prefs(filename, tempfile, false);
248 LYXERR0 ("Unable to convert " << filename.absFileName() <<
249 " to format " << LYXRC_FILEFORMAT);
252 // Keep this in the else branch, such that lexrc2 goes out
253 // of scope and releases the lock on tempfile before we
254 // attempt to remove it. This matters on Windows.
255 Lexer lexrc2(lyxrcTags);
256 lexrc2.setFile(tempfile);
257 LYXERR(Debug::LYXRC, "Reading '" << tempfile << "'...");
258 retval = read(lexrc2, check_format);
259 if (retval == FormatMismatch)
260 LYXERR0("Conversion failed for " << filename.absFileName());
262 return retval == ReadOK;
266 // don't need to worry about conversion, because this is always
267 // from an internal source
268 bool LyXRC::read(istream & is)
270 Lexer lexrc(lyxrcTags);
272 LYXERR(Debug::LYXRC, "Reading istream...");
273 return read(lexrc, false) == ReadOK;
277 LyXRC::ReturnValues LyXRC::read(Lexer & lexrc, bool check_format)
279 if (lyxerr.debugging(Debug::PARSER))
280 lexrc.printTable(lyxerr);
285 // format prior to 2.0 and introduction of format tag
286 unsigned int rc_format = 0;
288 #ifdef USE_MACOSX_PACKAGING
289 open_buffers_in_tabs = appleUserTabbingPreferenceAlways();
292 while (lexrc.isOK()) {
293 // By using two switches we take advantage of the compiler
294 // telling us if we have missed a LyXRCTags element in
295 // the second switch.
296 // Note that this also shows a problem with Lexer since it
297 // helps us avoid taking advantage of the strictness of the
300 int le = lexrc.lex();
302 case Lexer::LEX_UNDEF:
303 lexrc.printError("Unknown tag `$$Token'");
305 case Lexer::LEX_FEOF:
310 switch (static_cast<LyXRCTags>(le)) {
313 rc_format = lexrc.getInteger();
315 case RC_INPUT: // Include file
318 libFileSearch(string(),
320 if (!read(tmp, check_format)) {
322 "Error reading included file: " + tmp.absFileName());
328 bind_file = os::internal_path(lexrc.getString());
333 def_file = os::internal_path(lexrc.getString());
338 ui_file = os::internal_path(lexrc.getString());
341 case RC_AUTORESET_OPTIONS:
342 lexrc >> auto_reset_options;
345 case RC_DISPLAY_GRAPHICS:
347 display_graphics = lexrc.getString() == "true";
350 case RC_TEX_EXPECTS_WINDOWS_PATHS:
351 lexrc >> windows_style_tex_paths;
354 case RC_TEX_ALLOWS_SPACES:
355 lexrc >> tex_allows_spaces;
358 case RC_TEXINPUTS_PREFIX:
359 lexrc >> texinputs_prefix;
366 case RC_KBMAP_PRIMARY:
368 string const kmap(os::internal_path(lexrc.getString()));
369 if (!libFileSearch("kbd", kmap, "kmap").empty()
371 primary_kbmap = kmap;
373 lexrc.printError("LyX: Keymap `$$Token' not found");
378 case RC_KBMAP_SECONDARY:
380 string const kmap(os::internal_path(lexrc.getString()));
381 if (!libFileSearch("kbd", kmap, "kmap").empty()
383 secondary_kbmap = kmap;
385 lexrc.printError("LyX: Keymap `$$Token' not found");
390 case RC_PRINTLANDSCAPEFLAG:
391 lexrc >> print_landscape_flag;
394 case RC_PRINTPAPERDIMENSIONFLAG:
395 lexrc >> print_paper_dimension_flag;
398 case RC_PRINTPAPERFLAG:
399 lexrc >> print_paper_flag;
402 case RC_PYGMENTIZE_COMMAND:
403 if (lexrc.next(true)) {
404 pygmentize_command = lexrc.getString();
408 case RC_VIEWDVI_PAPEROPTION:
410 view_dvi_paper_option = lexrc.getString();
412 view_dvi_paper_option.erase();
415 case RC_CHKTEX_COMMAND:
416 if (lexrc.next(true)) {
417 chktex_command = lexrc.getString();
421 case RC_BIBTEX_ALTERNATIVES:
422 if (lexrc.next(true)) {
423 bibtex_alternatives.insert(lexrc.getString());
427 case RC_BIBTEX_COMMAND:
428 if (lexrc.next(true)) {
429 bibtex_command = lexrc.getString();
433 case RC_JBIBTEX_COMMAND:
434 if (lexrc.next(true)) {
435 jbibtex_command = lexrc.getString();
439 case RC_JBIBTEX_ALTERNATIVES:
440 if (lexrc.next(true)) {
441 jbibtex_alternatives.insert(lexrc.getString());
445 case RC_INDEX_ALTERNATIVES:
446 if (lexrc.next(true)) {
447 index_alternatives.insert(lexrc.getString());
451 case RC_INDEX_COMMAND:
452 if (lexrc.next(true)) {
453 index_command = lexrc.getString();
457 case RC_JINDEX_COMMAND:
458 if (lexrc.next(true)) {
459 jindex_command = lexrc.getString();
463 case RC_SPLITINDEX_COMMAND:
464 if (lexrc.next(true)) {
465 splitindex_command = lexrc.getString();
469 case RC_NOMENCL_COMMAND:
470 if (lexrc.next(true)) {
471 nomencl_command = lexrc.getString();
480 lexrc >> defaultZoom;
481 if (defaultZoom < 10)
485 case RC_GEOMETRY_SESSION:
486 lexrc >> allow_geometry_session;
489 case RC_SCREEN_FONT_SIZES:
490 lexrc >> font_sizes[TINY_SIZE];
491 lexrc >> font_sizes[SCRIPT_SIZE];
492 lexrc >> font_sizes[FOOTNOTE_SIZE];
493 lexrc >> font_sizes[SMALL_SIZE];
494 lexrc >> font_sizes[NORMAL_SIZE];
495 lexrc >> font_sizes[LARGE_SIZE];
496 lexrc >> font_sizes[LARGER_SIZE];
497 lexrc >> font_sizes[LARGEST_SIZE];
498 lexrc >> font_sizes[HUGE_SIZE];
499 lexrc >> font_sizes[HUGER_SIZE];
502 case RC_SCREEN_FONT_SCALABLE:
503 lexrc >> use_scalable_fonts;
510 case RC_DOCUMENTPATH:
512 document_path = os::internal_path(lexrc.getString());
517 example_path = os::internal_path(lexrc.getString());
520 case RC_TEMPLATEPATH:
522 template_path = os::internal_path(lexrc.getString());
527 tempdir_path = os::internal_path(lexrc.getString());
530 case RC_THESAURUSDIRPATH:
532 thesaurusdir_path = os::internal_path(lexrc.getString());
535 case RC_HUNSPELLDIR_PATH:
537 hunspelldir_path = os::internal_path(lexrc.getString());
540 case RC_USELASTFILEPOS:
541 lexrc >> use_lastfilepos;
545 lexrc >> load_session;
548 case RC_MOUSE_WHEEL_SPEED:
549 lexrc >> mouse_wheel_speed;
552 case RC_COMPLETION_INLINE_DELAY:
553 lexrc >> completion_inline_delay;
556 case RC_COMPLETION_INLINE_MATH:
557 lexrc >> completion_inline_math;
560 case RC_COMPLETION_INLINE_TEXT:
561 lexrc >> completion_inline_text;
564 case RC_COMPLETION_INLINE_DOTS:
565 lexrc >> completion_inline_dots;
568 case RC_AUTOCORRECTION_MATH:
569 lexrc >> autocorrection_math;
572 case RC_COMPLETION_POPUP_DELAY:
573 lexrc >> completion_popup_delay;
576 case RC_COMPLETION_POPUP_MATH:
577 lexrc >> completion_popup_math;
580 case RC_COMPLETION_POPUP_TEXT:
581 lexrc >> completion_popup_text;
584 case RC_COMPLETION_CURSOR_TEXT:
585 lexrc >> completion_cursor_text;
588 case RC_COMPLETION_POPUP_AFTER_COMPLETE:
589 lexrc >> completion_popup_after_complete;
592 case RC_COMPLETION_MINLENGTH:
593 lexrc >> completion_minlength;
596 case RC_NUMLASTFILES:
597 lexrc >> num_lastfiles;
600 case RC_CHECKLASTFILES:
601 lexrc >> check_lastfiles;
608 case RC_USE_SYSTEM_THEME_ICONS:
609 lexrc >> use_system_theme_icons;
612 case RC_SCREEN_FONT_ROMAN:
614 roman_font_name = lexrc.getString();
615 oldFontFormat(roman_font_name,
620 case RC_SCREEN_FONT_SANS:
622 sans_font_name = lexrc.getString();
623 oldFontFormat(sans_font_name, sans_font_foundry);
627 case RC_SCREEN_FONT_TYPEWRITER:
629 typewriter_font_name = lexrc.getString();
630 oldFontFormat(typewriter_font_name,
631 typewriter_font_foundry);
635 case RC_SCREEN_FONT_ROMAN_FOUNDRY:
636 lexrc >> roman_font_foundry;
639 case RC_SCREEN_FONT_SANS_FOUNDRY:
640 lexrc >> sans_font_foundry;
643 case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
644 lexrc >> typewriter_font_foundry;
649 lexrc.printError("Missing color tag.");
652 string const lyx_name = lexrc.getString();
655 lexrc.printError("Missing color name for color: `$$Token'");
658 string const x11_name = lexrc.getString();
660 string x11_darkname = x11_name;
662 x11_darkname = lexrc.getString();
664 ColorCode const col =
665 lcolor.getFromLyXName(lyx_name);
666 if (col == Color_none ||
667 col == Color_inherit ||
671 if (!lcolor.setColor(col, x11_name, x11_darkname))
672 LYXERR0("Bad lyxrc set_color for " << lyx_name);
673 LYXERR(Debug::LYXRC, "Set " << lyx_name << "(" << col << ") to "
674 << x11_name << " and " << x11_darkname);
678 case RC_AUTOREGIONDELETE:
679 // Auto region delete defaults to true
680 lexrc >> auto_region_delete;
685 string userdir = package().user_support().absFileName();
686 if (userdir.back() == '/')
688 lyxpipes = subst(os::internal_path(lexrc.getString()), "$$UserDir",
693 case RC_CITATION_SEARCH:
694 lexrc >> citation_search;
697 case RC_CITATION_SEARCH_PATTERN:
699 citation_search_pattern = lexrc.getString();
702 case RC_CITATION_SEARCH_VIEW:
704 citation_search_view = lexrc.getString();
707 case RC_CT_ADDITIONS_UNDERLINED:
708 lexrc >> ct_additions_underlined;
711 case RC_CT_MARKUP_COPIED:
712 lexrc >> ct_markup_copied;
715 case RC_CURSOR_FOLLOWS_SCROLLBAR:
716 lexrc >> cursor_follows_scrollbar;
719 case RC_CURSOR_WIDTH:
720 lexrc >> cursor_width;
723 case RC_SCROLL_BELOW_DOCUMENT:
724 lexrc >> scroll_below_document;
727 case RC_PARAGRAPH_MARKERS:
728 lexrc >> paragraph_markers;
731 case RC_MAC_DONTSWAP_CTRL_META:
732 lexrc >> mac_dontswap_ctrl_meta;
735 case RC_MAC_LIKE_CURSOR_MOVEMENT:
736 lexrc >> mac_like_cursor_movement;
739 case RC_MACRO_EDIT_STYLE:
741 switch (lexrc.getInteger()) {
742 case 0: macro_edit_style = MACRO_EDIT_INLINE_BOX; break;
743 case 1: macro_edit_style = MACRO_EDIT_INLINE; break;
744 case 2: macro_edit_style = MACRO_EDIT_LIST; break;
749 case RC_DIALOGS_ICONIFY_WITH_MAIN:
750 lexrc >> dialogs_iconify_with_main;
753 case RC_PLAINTEXT_LINELEN:
754 lexrc >> plaintext_linelen;
756 // Spellchecker settings:
757 case RC_ACCEPT_COMPOUND:
758 lexrc >> spellchecker_accept_compound;
760 case RC_USE_NATIVE_FILEDIALOG:
761 lexrc >> use_native_filedialog;
763 case RC_USE_SYSTEM_COLORS:
764 lexrc >> use_system_colors;
767 lexrc >> use_tooltip;
769 case RC_SPELLCHECKER:
770 lexrc >> spellchecker;
773 lexrc >> spellchecker_alt_lang;
776 lexrc >> spellchecker_esc_chars;
778 case RC_SPELLCHECK_CONTINUOUSLY:
779 lexrc >> spellcheck_continuously;
781 case RC_SPELLCHECK_NOTES:
782 lexrc >> spellcheck_notes;
785 lexrc >> make_backup;
787 case RC_SAVE_COMPRESSED:
788 lexrc >> save_compressed;
791 lexrc >> save_origin;
793 case RC_BACKUPDIR_PATH:
795 backupdir_path = os::internal_path(lexrc.getString());
797 case RC_DEFAULT_DECIMAL_SEP:
798 lexrc >> default_decimal_sep;
800 case RC_DEFAULT_LENGTH_UNIT:
802 default_length_unit = (Length::UNIT) lexrc.getInteger();
804 case RC_LANGUAGE_CUSTOM_PACKAGE:
805 lexrc >> language_custom_package;
807 case RC_LANGUAGE_AUTO_BEGIN:
808 lexrc >> language_auto_begin;
810 case RC_LANGUAGE_AUTO_END:
811 lexrc >> language_auto_end;
813 case RC_LANGUAGE_GLOBAL_OPTIONS:
814 lexrc >> language_global_options;
816 case RC_LANGUAGE_PACKAGE_SELECTION:
818 switch (lexrc.getInteger()) {
820 language_package_selection = LP_AUTO;
823 language_package_selection = LP_BABEL;
826 language_package_selection = LP_CUSTOM;
829 language_package_selection = LP_NONE;
834 case RC_LANGUAGE_COMMAND_BEGIN:
835 lexrc >> language_command_begin;
837 case RC_LANGUAGE_COMMAND_END:
838 lexrc >> language_command_end;
840 case RC_LANGUAGE_COMMAND_LOCAL:
841 lexrc >> language_command_local;
843 case RC_RESPECT_OS_KBD_LANGUAGE:
844 lexrc >> respect_os_kbd_language;
846 case RC_VISUAL_CURSOR:
847 lexrc >> visual_cursor;
849 case RC_CLOSE_BUFFER_WITH_LAST_VIEW:
850 lexrc >> close_buffer_with_last_view;
853 lexrc >> auto_number;
855 case RC_MARK_FOREIGN_LANGUAGE:
856 lexrc >> mark_foreign_language;
862 fmt = lexrc.getString();
863 if (lexrc.next(true))
864 command = lexrc.getString();
865 setMover(fmt, command);
870 string from, to, command, flags;
872 from = lexrc.getString();
874 to = lexrc.getString();
875 if (lexrc.next(true))
876 command = lexrc.getString();
878 flags = lexrc.getString();
880 theConverters().erase(from, to);
882 theConverters().add(from, to, command, flags);
885 // compatibility with versions older than 1.4.0 only
887 string format, command;
888 lexrc >> format >> command;
889 theFormats().setViewer(format, command);
892 case RC_FILEFORMAT: {
894 string format, extensions, shortcut;
895 docstring prettyname;
896 if (!(lexrc >> format >> extensions))
898 if (ok && lexrc.next(true))
899 prettyname = lexrc.getDocString();
903 if(!(lexrc >> shortcut))
905 string viewer, editor;
906 if (ok && lexrc.next(true))
907 viewer = lexrc.getString();
910 if (ok && lexrc.next(true))
911 editor = lexrc.getString();
915 if (!(lexrc >> flags >> mime))
917 int flgs = Format::none;
918 while (!flags.empty()) {
920 flags = split(flags, flag, ',');
921 if (flag == "document")
922 flgs |= Format::document;
923 else if (flag == "vector")
924 flgs |= Format::vector;
925 else if (flag == "zipped=native")
926 flgs |= Format::zipped_native;
927 else if (flag == "menu=export")
928 flgs |= Format::export_menu;
929 else if (flag == "menu=none")
930 flgs |= Format::no_menu;
932 LYXERR0("Ignoring unknown flag `"
933 << flag << "' for format `"
937 LYXERR0("Syntax error in format " << format);
938 else if (prettyname.empty()) {
939 if (theConverters().formatIsUsed(format))
940 LYXERR0("Can't delete format " << format);
942 theFormats().erase(format);
944 theFormats().add(format, extensions, prettyname,
945 shortcut, viewer, editor, mime, flgs);
949 case RC_VIEWER_ALTERNATIVES: {
950 string format, command;
951 if ((lexrc >> format) && lexrc.next(true)) {
952 command = lexrc.getString();
953 viewer_alternatives[format].insert(command);
957 case RC_EDITOR_ALTERNATIVES: {
958 string format, command;
959 if ((lexrc >> format) && lexrc.next(true)) {
960 command = lexrc.getString();
961 editor_alternatives[format].insert(command);
966 case RC_DEFAULT_OTF_VIEW_FORMAT:
967 lexrc >> default_otf_view_format;
970 case RC_DEFAULT_PLATEX_VIEW_FORMAT:
971 lexrc >> default_platex_view_format;
974 case RC_DEFAULT_VIEW_FORMAT:
975 lexrc >> default_view_format;
978 case RC_GUI_LANGUAGE:
979 lexrc >> gui_language;
983 lexrc >> show_banner;
988 string const tmp = lexrc.getString();
989 if (tmp == "true" || tmp == "on")
990 preview = PREVIEW_ON;
991 else if (tmp == "no_math")
992 preview = PREVIEW_NO_MATH;
994 preview = PREVIEW_OFF;
995 if (tmp != "false" && tmp != "off")
996 LYXERR0("Unrecognized preview status \""
1002 case RC_PREVIEW_HASHED_LABELS:
1003 lexrc >> preview_hashed_labels;
1006 case RC_PREVIEW_SCALE_FACTOR:
1007 lexrc >> preview_scale_factor;
1014 lexrc >> user_email;
1016 case RC_USER_INITIALS:
1017 lexrc >> user_initials;
1020 case RC_PATH_PREFIX:
1021 lexrc >> path_prefix;
1024 case RC_USE_CONVERTER_CACHE:
1025 lexrc >> use_converter_cache;
1027 case RC_USE_CONVERTER_NEEDAUTH_FORBIDDEN:
1028 lexrc >> use_converter_needauth_forbidden;
1030 case RC_USE_CONVERTER_NEEDAUTH:
1031 lexrc >> use_converter_needauth;
1033 case RC_CONVERTER_CACHE_MAXAGE:
1034 lexrc >> converter_cache_maxage;
1037 case RC_SORT_LAYOUTS:
1038 lexrc >> sort_layouts;
1040 case RC_GROUP_LAYOUTS:
1041 lexrc >> group_layouts;
1043 case RC_FULL_SCREEN_LIMIT:
1044 lexrc >> full_screen_limit;
1046 case RC_FULL_SCREEN_TOOLBARS:
1047 lexrc >> full_screen_toolbars;
1049 case RC_FULL_SCREEN_SCROLLBAR:
1050 lexrc >> full_screen_scrollbar;
1052 case RC_FULL_SCREEN_STATUSBAR:
1053 lexrc >> full_screen_statusbar;
1055 case RC_FULL_SCREEN_TABBAR:
1056 lexrc >> full_screen_tabbar;
1058 case RC_FULL_SCREEN_MENUBAR:
1059 lexrc >> full_screen_menubar;
1061 case RC_FULL_SCREEN_WIDTH:
1062 lexrc >> full_screen_width;
1064 case RC_OPEN_BUFFERS_IN_TABS:
1065 lexrc >> open_buffers_in_tabs;
1067 case RC_SINGLE_CLOSE_TAB_BUTTON:
1068 lexrc >> single_close_tab_button;
1070 case RC_SINGLE_INSTANCE:
1071 lexrc >> single_instance;
1072 if (run_mode == PREFERRED)
1073 run_mode = single_instance ? USE_REMOTE : NEW_INSTANCE;
1075 case RC_FORWARD_SEARCH_DVI:
1076 if (lexrc.next(true))
1077 forward_search_dvi = lexrc.getString();
1079 case RC_FORWARD_SEARCH_PDF:
1080 if (lexrc.next(true))
1081 forward_search_pdf = lexrc.getString();
1083 case RC_EXPORT_OVERWRITE:
1085 string const tmp = lexrc.getString();
1086 if (tmp == "all" || tmp == "true")
1087 export_overwrite = ALL_FILES;
1088 else if (tmp == "main")
1089 export_overwrite = MAIN_FILE;
1091 export_overwrite = NO_FILES;
1092 if (tmp != "ask" && tmp != "false")
1093 LYXERR0("Unrecognized export_overwrite status \""
1098 case RC_SCROLL_WHEEL_ZOOM:
1100 string const tmp = lexrc.getString();
1102 scroll_wheel_zoom = SCROLL_WHEEL_ZOOM_CTRL;
1103 else if (tmp == "shift")
1104 scroll_wheel_zoom = SCROLL_WHEEL_ZOOM_SHIFT;
1105 else if (tmp == "alt")
1106 scroll_wheel_zoom = SCROLL_WHEEL_ZOOM_ALT;
1108 scroll_wheel_zoom = SCROLL_WHEEL_ZOOM_OFF;
1109 if (tmp != "off" && tmp != "false")
1110 LYXERR0("Unrecognized scroll_wheel_zoom status \""
1116 case RC_MOUSE_MIDDLEBUTTON_PASTE:
1117 lexrc >> mouse_middlebutton_paste;
1121 break; // this is just a dummy
1124 // This is triggered the first time through the loop unless
1125 // we hit a format tag.
1126 if (check_format && rc_format != LYXRC_FILEFORMAT)
1127 return FormatMismatch;
1130 /// Update converters data-structures
1131 theConverters().update(theFormats());
1132 theConverters().buildGraph();
1133 theBufferList().invalidateConverterCache();
1139 void LyXRC::write(FileName const & filename, bool ignore_system_lyxrc) const
1141 ofstream ofs(filename.toFilesystemEncoding().c_str());
1143 write(ofs, ignore_system_lyxrc);
1147 void LyXRC::print() const
1149 if (lyxerr.debugging())
1150 write(lyxerr, false);
1158 typedef pair<string, SpecialisedMover> Data;
1160 SameMover(Data const & comparison)
1161 : comparison_(comparison) {}
1163 bool operator()(Data const & data) const
1165 return data.first == comparison_.first &&
1166 data.second.command() == comparison_.second.command();
1176 // Escape \ and " so that LyXLex can read the string later
1177 string escapeCommand(string const & str) {
1178 return subst(subst(str , "\\", "\\\\"),
1185 void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) const
1187 LyXRCTags tag = RC_LAST;
1189 if (!name.empty()) {
1190 for (int i = 0; i != lyxrcCount; ++i)
1191 if ("\\" + name == lyxrcTags[i].tag)
1192 tag = static_cast<LyXRCTags>(lyxrcTags[i].code);
1196 os << "# LyX " << lyx_version
1197 << " generated this file. If you want to make your own\n"
1198 << "# modifications you should do them from inside LyX and save.\n\n"
1199 << "Format " << LYXRC_FILEFORMAT << "\n\n";
1201 // Why the switch you might ask. It is a trick to ensure that all
1202 // the elements in the LyXRCTags enum are handled. As you can see
1203 // there are no breaks at all. So it is just a huge fall-through.
1204 // The nice thing is that we will get a warning from the compiler
1205 // if we forget an element.
1209 // input/include files are not done here
1210 case RC_LYXRCFORMAT:
1212 if (ignore_system_lyxrc ||
1213 bind_file != system_lyxrc.bind_file) {
1214 string const path = os::external_path(bind_file);
1215 os << "\\bind_file \"" << path << "\"\n";
1221 if (ignore_system_lyxrc ||
1222 def_file != system_lyxrc.def_file) {
1223 string const path = os::external_path(def_file);
1224 os << "\\def_file \"" << path << "\"\n";
1233 << "# MISC SECTION ######################################\n"
1235 // bind files are not done here.
1237 case RC_PATH_PREFIX:
1238 if (ignore_system_lyxrc ||
1239 path_prefix != system_lyxrc.path_prefix) {
1240 os << "\\path_prefix \"" << path_prefix << "\"\n";
1246 if (ignore_system_lyxrc ||
1247 ui_file != system_lyxrc.ui_file) {
1248 string const path = os::external_path(ui_file);
1249 os << "\\ui_file \"" << path << "\"\n";
1254 case RC_AUTOREGIONDELETE:
1255 if (ignore_system_lyxrc ||
1256 auto_region_delete != system_lyxrc.auto_region_delete) {
1257 os << "# Set to false to inhibit automatic replacement of\n"
1258 << "# the current selection.\n"
1259 << "\\auto_region_delete " << convert<string>(auto_region_delete)
1265 case RC_AUTORESET_OPTIONS:
1266 if (ignore_system_lyxrc ||
1267 auto_reset_options != system_lyxrc.auto_reset_options) {
1268 os << "# Set to false to inhibit automatic reset of\n"
1269 << "# the class options to defaults on class change.\n"
1270 << "\\auto_reset_options "
1271 << convert<string>(auto_reset_options)
1278 if (ignore_system_lyxrc ||
1279 autosave != system_lyxrc.autosave) {
1280 os << "# The time interval between auto-saves in seconds.\n"
1281 << "\\autosave " << autosave << '\n';
1286 case RC_DISPLAY_GRAPHICS:
1287 if (ignore_system_lyxrc ||
1288 display_graphics != system_lyxrc.display_graphics) {
1289 os << "# Display graphics within LyX\n"
1291 << "\\display_graphics "
1292 << (display_graphics ? "true" : "false")
1298 case RC_SORT_LAYOUTS:
1299 if (ignore_system_lyxrc ||
1300 sort_layouts != system_lyxrc.sort_layouts) {
1301 os << "# Sort layouts alphabetically.\n"
1302 << "\\sort_layouts " << convert<string>(sort_layouts) << '\n';
1307 case RC_GROUP_LAYOUTS:
1308 if (ignore_system_lyxrc ||
1309 group_layouts != system_lyxrc.group_layouts) {
1310 os << "# Group layouts by their category.\n"
1311 << "\\group_layouts " << convert<string>(group_layouts) << '\n';
1316 case RC_VIEWDVI_PAPEROPTION:
1317 if (ignore_system_lyxrc ||
1318 view_dvi_paper_option
1319 != system_lyxrc.view_dvi_paper_option) {
1320 os << "# Options used to specify paper size to the\n"
1321 << "# view_dvi_command (e.g. -paper)\n"
1322 << "\\view_dvi_paper_option \""
1323 << view_dvi_paper_option << "\"\n";
1328 case RC_CHKTEX_COMMAND:
1329 if (ignore_system_lyxrc ||
1330 chktex_command != system_lyxrc.chktex_command) {
1331 os << "\\chktex_command \"" << escapeCommand(chktex_command) << "\"\n";
1336 case RC_BIBTEX_ALTERNATIVES: {
1337 CommandSet::const_iterator it = bibtex_alternatives.begin();
1338 CommandSet::const_iterator end = bibtex_alternatives.end();
1339 for ( ; it != end; ++it) {
1340 if (ignore_system_lyxrc
1341 || !system_lyxrc.bibtex_alternatives.count(*it))
1342 os << "\\bibtex_alternatives \""
1349 case RC_BIBTEX_COMMAND:
1350 if (ignore_system_lyxrc ||
1351 bibtex_command != system_lyxrc.bibtex_command) {
1352 os << "\\bibtex_command \"" << escapeCommand(bibtex_command) << "\"\n";
1357 case RC_JBIBTEX_COMMAND:
1358 if (ignore_system_lyxrc ||
1359 jbibtex_command != system_lyxrc.jbibtex_command) {
1360 os << "\\jbibtex_command \"" << escapeCommand(jbibtex_command) << "\"\n";
1365 case RC_JBIBTEX_ALTERNATIVES: {
1366 CommandSet::const_iterator it = jbibtex_alternatives.begin();
1367 CommandSet::const_iterator end = jbibtex_alternatives.end();
1368 for ( ; it != end; ++it) {
1369 if (ignore_system_lyxrc
1370 || !system_lyxrc.jbibtex_alternatives.count(*it))
1371 os << "\\jbibtex_alternatives \""
1378 case RC_INDEX_ALTERNATIVES: {
1379 CommandSet::const_iterator it = index_alternatives.begin();
1380 CommandSet::const_iterator end = index_alternatives.end();
1381 for ( ; it != end; ++it) {
1382 if (ignore_system_lyxrc
1383 || !system_lyxrc.index_alternatives.count(*it))
1384 os << "\\index_alternatives \""
1391 case RC_INDEX_COMMAND:
1392 if (ignore_system_lyxrc ||
1393 index_command != system_lyxrc.index_command) {
1394 os << "\\index_command \"" << escapeCommand(index_command) << "\"\n";
1399 case RC_JINDEX_COMMAND:
1400 if (ignore_system_lyxrc ||
1401 jindex_command != system_lyxrc.jindex_command) {
1402 os << "\\jindex_command \"" << escapeCommand(jindex_command) << "\"\n";
1407 case RC_SPLITINDEX_COMMAND:
1408 if (ignore_system_lyxrc ||
1409 splitindex_command != system_lyxrc.splitindex_command) {
1410 os << "\\splitindex_command \"" << escapeCommand(splitindex_command) << "\"\n";
1415 case RC_NOMENCL_COMMAND:
1416 if (ignore_system_lyxrc ||
1417 nomencl_command != system_lyxrc.nomencl_command) {
1418 os << "\\nomencl_command \"" << escapeCommand(nomencl_command) << "\"\n";
1423 case RC_PYGMENTIZE_COMMAND:
1424 if (ignore_system_lyxrc ||
1425 pygmentize_command != system_lyxrc.pygmentize_command) {
1426 os << "\\pygmentize_command \"" << escapeCommand(pygmentize_command) << "\"\n";
1431 case RC_TEX_EXPECTS_WINDOWS_PATHS:
1432 // Don't write this setting to the preferences file,
1433 // but allow temporary changes (bug 7557).
1434 if (ignore_system_lyxrc) {
1435 os << "\\tex_expects_windows_paths "
1436 << convert<string>(windows_style_tex_paths) << '\n';
1441 case RC_TEX_ALLOWS_SPACES:
1442 if (tex_allows_spaces != system_lyxrc.tex_allows_spaces) {
1443 os << "\\tex_allows_spaces "
1444 << convert<string>(tex_allows_spaces) << '\n';
1450 if (ignore_system_lyxrc ||
1451 use_kbmap != system_lyxrc.use_kbmap) {
1452 os << "\\kbmap " << convert<string>(use_kbmap) << '\n';
1457 case RC_KBMAP_PRIMARY:
1458 if (ignore_system_lyxrc ||
1459 primary_kbmap != system_lyxrc.primary_kbmap) {
1460 string const path = os::external_path(primary_kbmap);
1461 os << "\\kbmap_primary \"" << path << "\"\n";
1466 case RC_KBMAP_SECONDARY:
1467 if (ignore_system_lyxrc ||
1468 secondary_kbmap != system_lyxrc.secondary_kbmap) {
1469 string const path = os::external_path(secondary_kbmap);
1470 os << "\\kbmap_secondary \"" << path << "\"\n";
1476 if (ignore_system_lyxrc ||
1477 lyxpipes != system_lyxrc.lyxpipes) {
1478 string const path = os::external_path(lyxpipes);
1479 os << "\\serverpipe \"" << path << "\"\n";
1485 os << "\\user_name \"" << user_name << "\"\n";
1490 os << "\\user_email \"" << user_email << "\"\n";
1494 case RC_USER_INITIALS:
1495 os << "\\user_initials \"" << user_initials << "\"\n";
1499 case RC_SHOW_BANNER:
1500 if (ignore_system_lyxrc ||
1501 show_banner != system_lyxrc.show_banner) {
1502 os << "\\show_banner " << convert<string>(show_banner) << '\n';
1508 if (ignore_system_lyxrc ||
1509 preview != system_lyxrc.preview) {
1515 case PREVIEW_NO_MATH:
1522 os << "\\preview " << status << '\n';
1527 case RC_PREVIEW_HASHED_LABELS:
1528 if (ignore_system_lyxrc ||
1529 preview_hashed_labels !=
1530 system_lyxrc.preview_hashed_labels) {
1531 os << "\\preview_hashed_labels "
1532 << convert<string>(preview_hashed_labels) << '\n';
1537 case RC_PREVIEW_SCALE_FACTOR:
1538 if (ignore_system_lyxrc ||
1539 preview_scale_factor != system_lyxrc.preview_scale_factor) {
1540 os << "\\preview_scale_factor "
1541 << preview_scale_factor << '\n';
1546 case RC_USE_CONVERTER_CACHE:
1547 if (ignore_system_lyxrc ||
1548 use_converter_cache != system_lyxrc.use_converter_cache) {
1549 os << "\\use_converter_cache "
1550 << convert<string>(use_converter_cache) << '\n';
1555 case RC_USE_CONVERTER_NEEDAUTH_FORBIDDEN:
1556 if (ignore_system_lyxrc ||
1557 use_converter_needauth_forbidden != system_lyxrc.use_converter_needauth_forbidden) {
1558 os << "\\use_converter_needauth_forbidden "
1559 << convert<string>(use_converter_needauth_forbidden) << '\n';
1564 case RC_USE_CONVERTER_NEEDAUTH:
1565 if (ignore_system_lyxrc ||
1566 use_converter_needauth != system_lyxrc.use_converter_needauth) {
1567 os << "\\use_converter_needauth "
1568 << convert<string>(use_converter_needauth) << '\n';
1573 case RC_CONVERTER_CACHE_MAXAGE:
1574 if (ignore_system_lyxrc ||
1575 converter_cache_maxage != system_lyxrc.converter_cache_maxage) {
1576 os << "\\converter_cache_maxage "
1577 << converter_cache_maxage << '\n';
1583 << "# SCREEN & FONTS SECTION ############################\n"
1587 if (ignore_system_lyxrc ||
1588 icon_set != system_lyxrc.icon_set) {
1589 os << "\\icon_set \"" << icon_set
1595 case RC_USE_SYSTEM_THEME_ICONS:
1596 if (ignore_system_lyxrc ||
1597 use_system_theme_icons != system_lyxrc.use_system_theme_icons) {
1598 os << "\\use_system_theme_icons "
1599 << convert<string>(use_system_theme_icons)
1606 if (ignore_system_lyxrc ||
1607 dpi != system_lyxrc.dpi) {
1608 os << "\\screen_dpi " << dpi << '\n';
1613 case RC_SCREEN_ZOOM:
1614 if (ignore_system_lyxrc ||
1615 defaultZoom != system_lyxrc.defaultZoom) {
1616 os << "\\screen_zoom " << defaultZoom << '\n';
1621 case RC_GEOMETRY_SESSION:
1622 if (ignore_system_lyxrc ||
1623 allow_geometry_session != system_lyxrc.allow_geometry_session) {
1624 os << "\\allow_geometry_session " << convert<string>(allow_geometry_session)
1630 case RC_CITATION_SEARCH:
1631 if (ignore_system_lyxrc ||
1632 citation_search != system_lyxrc.citation_search) {
1633 os << "# Set to true to use script to search\n"
1634 << "# locl disk for citation targets.\n"
1635 << "\\citation_search "
1636 << convert<string>(citation_search)
1642 case RC_CITATION_SEARCH_VIEW:
1643 if (ignore_system_lyxrc ||
1644 citation_search_view != system_lyxrc.citation_search_view) {
1645 os << "\\citation_search_view \""
1646 << citation_search_view << "\"\n";
1651 case RC_CITATION_SEARCH_PATTERN:
1652 if (ignore_system_lyxrc ||
1653 citation_search_pattern != system_lyxrc.citation_search_pattern) {
1654 os << "\\citation_search_pattern \""
1655 << citation_search_pattern << "\"\n";
1660 case RC_CT_ADDITIONS_UNDERLINED:
1661 if (ignore_system_lyxrc ||
1662 ct_additions_underlined
1663 != system_lyxrc.ct_additions_underlined) {
1664 os << "\\ct_additions_underlined "
1665 << convert<string>(ct_additions_underlined) << '\n';
1670 case RC_CT_MARKUP_COPIED:
1671 if (ignore_system_lyxrc ||
1673 != system_lyxrc.ct_markup_copied) {
1674 os << "\\ct_markup_copied "
1675 << convert<string>(ct_markup_copied) << '\n';
1680 case RC_CURSOR_FOLLOWS_SCROLLBAR:
1681 if (ignore_system_lyxrc ||
1682 cursor_follows_scrollbar
1683 != system_lyxrc.cursor_follows_scrollbar) {
1684 os << "\\cursor_follows_scrollbar "
1685 << convert<string>(cursor_follows_scrollbar) << '\n';
1690 case RC_CURSOR_WIDTH:
1691 if (ignore_system_lyxrc ||
1693 != system_lyxrc.cursor_width) {
1694 os << "\\cursor_width "
1695 << cursor_width << '\n';
1700 case RC_SCROLL_BELOW_DOCUMENT:
1701 if (ignore_system_lyxrc ||
1702 scroll_below_document
1703 != system_lyxrc.scroll_below_document) {
1704 os << "\\scroll_below_document "
1705 << convert<string>(scroll_below_document) << '\n';
1710 case RC_PARAGRAPH_MARKERS:
1711 if (ignore_system_lyxrc ||
1713 != system_lyxrc.paragraph_markers) {
1714 os << "\\paragraph_markers "
1715 << convert<string>(paragraph_markers) << '\n';
1720 case RC_MAC_DONTSWAP_CTRL_META:
1721 if (ignore_system_lyxrc ||
1722 mac_dontswap_ctrl_meta
1723 != system_lyxrc.mac_dontswap_ctrl_meta) {
1724 os << "\\mac_dontswap_ctrl_meta "
1725 << convert<string>(mac_dontswap_ctrl_meta) << '\n';
1730 case RC_MAC_LIKE_CURSOR_MOVEMENT:
1731 if (ignore_system_lyxrc ||
1732 mac_like_cursor_movement
1733 != system_lyxrc.mac_like_cursor_movement) {
1734 os << "\\mac_like_cursor_movement "
1735 << convert<string>(mac_like_cursor_movement) << '\n';
1740 case RC_MACRO_EDIT_STYLE:
1741 if (ignore_system_lyxrc ||
1743 != system_lyxrc.macro_edit_style) {
1744 os << "\\macro_edit_style ";
1745 switch (macro_edit_style) {
1746 case MACRO_EDIT_INLINE_BOX: os << "0\n"; break;
1747 case MACRO_EDIT_INLINE: os << "1\n"; break;
1748 case MACRO_EDIT_LIST: os << "2\n"; break;
1754 case RC_DIALOGS_ICONIFY_WITH_MAIN:
1755 if (ignore_system_lyxrc ||
1756 dialogs_iconify_with_main
1757 != system_lyxrc.dialogs_iconify_with_main) {
1758 os << "\\dialogs_iconify_with_main "
1759 << convert<string>(dialogs_iconify_with_main) << '\n';
1764 case RC_SCREEN_FONT_ROMAN:
1765 if (ignore_system_lyxrc ||
1766 roman_font_name != system_lyxrc.roman_font_name) {
1767 os << "\\screen_font_roman \"" << roman_font_name
1773 case RC_SCREEN_FONT_ROMAN_FOUNDRY:
1774 if (ignore_system_lyxrc ||
1775 roman_font_foundry != system_lyxrc.roman_font_foundry) {
1776 os << "\\screen_font_roman_foundry \"" << roman_font_foundry
1782 case RC_SCREEN_FONT_SANS:
1783 if (ignore_system_lyxrc ||
1784 sans_font_name != system_lyxrc.sans_font_name) {
1785 os << "\\screen_font_sans \"" << sans_font_name
1791 case RC_SCREEN_FONT_SANS_FOUNDRY:
1792 if (ignore_system_lyxrc ||
1793 sans_font_foundry != system_lyxrc.sans_font_foundry) {
1794 os << "\\screen_font_sans_foundry \"" << sans_font_foundry
1800 case RC_SCREEN_FONT_TYPEWRITER:
1801 if (ignore_system_lyxrc ||
1802 typewriter_font_name != system_lyxrc.typewriter_font_name) {
1803 os << "\\screen_font_typewriter \""
1804 << typewriter_font_name << "\"\n";
1809 case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
1810 if (ignore_system_lyxrc ||
1811 typewriter_font_foundry != system_lyxrc.typewriter_font_foundry) {
1812 os << "\\screen_font_typewriter_foundry \""
1813 << typewriter_font_foundry << "\"\n";
1818 case RC_SCREEN_FONT_SCALABLE:
1819 if (ignore_system_lyxrc ||
1820 use_scalable_fonts != system_lyxrc.use_scalable_fonts) {
1821 os << "\\screen_font_scalable "
1822 << convert<string>(use_scalable_fonts)
1828 case RC_SCREEN_FONT_SIZES:
1829 if (ignore_system_lyxrc ||
1830 font_sizes[TINY_SIZE]
1831 != system_lyxrc.font_sizes[TINY_SIZE] ||
1832 font_sizes[SCRIPT_SIZE]
1833 != system_lyxrc.font_sizes[SCRIPT_SIZE] ||
1834 font_sizes[FOOTNOTE_SIZE]
1835 != system_lyxrc.font_sizes[FOOTNOTE_SIZE] ||
1836 font_sizes[SMALL_SIZE]
1837 != system_lyxrc.font_sizes[SMALL_SIZE] ||
1838 font_sizes[NORMAL_SIZE]
1839 != system_lyxrc.font_sizes[NORMAL_SIZE] ||
1840 font_sizes[LARGE_SIZE]
1841 != system_lyxrc.font_sizes[LARGE_SIZE] ||
1842 font_sizes[LARGER_SIZE]
1843 != system_lyxrc.font_sizes[LARGER_SIZE] ||
1844 font_sizes[LARGEST_SIZE]
1845 != system_lyxrc.font_sizes[LARGEST_SIZE] ||
1846 font_sizes[HUGE_SIZE]
1847 != system_lyxrc.font_sizes[HUGE_SIZE] ||
1848 font_sizes[HUGER_SIZE]
1849 != system_lyxrc.font_sizes[HUGER_SIZE]) {
1850 streamsize old_prec = os.precision();
1851 os.setf(ios::fixed);
1853 os << "\\screen_font_sizes"
1854 << ' ' << font_sizes[TINY_SIZE]
1855 << ' ' << font_sizes[SCRIPT_SIZE]
1856 << ' ' << font_sizes[FOOTNOTE_SIZE]
1857 << ' ' << font_sizes[SMALL_SIZE]
1858 << ' ' << font_sizes[NORMAL_SIZE]
1859 << ' ' << font_sizes[LARGE_SIZE]
1860 << ' ' << font_sizes[LARGER_SIZE]
1861 << ' ' << font_sizes[LARGEST_SIZE]
1862 << ' ' << font_sizes[HUGE_SIZE]
1863 << ' ' << font_sizes[HUGER_SIZE]
1865 os.precision(old_prec);
1866 os.unsetf(ios::fixed);
1871 case RC_FULL_SCREEN_LIMIT:
1872 if (ignore_system_lyxrc ||
1873 full_screen_limit != system_lyxrc.full_screen_limit) {
1874 os << "\\fullscreen_limit "
1875 << convert<string>(full_screen_limit)
1881 case RC_FULL_SCREEN_TOOLBARS:
1882 if (ignore_system_lyxrc ||
1883 full_screen_toolbars != system_lyxrc.full_screen_toolbars) {
1884 os << "\\fullscreen_toolbars "
1885 << convert<string>(full_screen_toolbars)
1891 case RC_FULL_SCREEN_SCROLLBAR:
1892 if (ignore_system_lyxrc ||
1893 full_screen_scrollbar != system_lyxrc.full_screen_scrollbar) {
1894 os << "\\fullscreen_scrollbar "
1895 << convert<string>(full_screen_scrollbar)
1901 case RC_FULL_SCREEN_STATUSBAR:
1902 if (ignore_system_lyxrc ||
1903 full_screen_statusbar != system_lyxrc.full_screen_statusbar) {
1904 os << "\\fullscreen_statusbar "
1905 << convert<string>(full_screen_statusbar)
1911 case RC_FULL_SCREEN_TABBAR:
1912 if (ignore_system_lyxrc ||
1913 full_screen_tabbar != system_lyxrc.full_screen_tabbar) {
1914 os << "\\fullscreen_tabbar "
1915 << convert<string>(full_screen_tabbar)
1921 case RC_FULL_SCREEN_MENUBAR:
1922 if (ignore_system_lyxrc ||
1923 full_screen_menubar != system_lyxrc.full_screen_menubar) {
1924 os << "\\fullscreen_menubar "
1925 << convert<string>(full_screen_menubar)
1931 case RC_FULL_SCREEN_WIDTH:
1932 if (ignore_system_lyxrc ||
1933 full_screen_width != system_lyxrc.full_screen_width) {
1934 os << "\\fullscreen_width "
1935 << convert<string>(full_screen_width)
1941 case RC_OPEN_BUFFERS_IN_TABS:
1942 if (ignore_system_lyxrc ||
1943 open_buffers_in_tabs != system_lyxrc.open_buffers_in_tabs) {
1944 os << "\\open_buffers_in_tabs "
1945 << convert<string>(open_buffers_in_tabs)
1951 case RC_SINGLE_CLOSE_TAB_BUTTON:
1952 if (ignore_system_lyxrc ||
1953 single_close_tab_button != system_lyxrc.single_close_tab_button) {
1954 os << "\\single_close_tab_button "
1955 << convert<string>(single_close_tab_button)
1961 case RC_SINGLE_INSTANCE:
1962 if (ignore_system_lyxrc ||
1963 single_instance != system_lyxrc.single_instance) {
1964 os << "\\single_instance "
1965 << convert<string>(single_instance)
1971 case RC_FORWARD_SEARCH_DVI:
1972 if (ignore_system_lyxrc ||
1973 forward_search_dvi != system_lyxrc.forward_search_dvi) {
1974 os << "\\forward_search_dvi \"" << escapeCommand(forward_search_dvi) << "\"\n";
1979 case RC_FORWARD_SEARCH_PDF:
1980 if (ignore_system_lyxrc ||
1981 forward_search_pdf != system_lyxrc.forward_search_pdf) {
1982 os << "\\forward_search_pdf \"" << escapeCommand(forward_search_pdf) << "\"\n";
1988 << "# COLOR SECTION ###################################\n"
1993 for (int i = 0; i < Color_ignore; ++i) {
1994 ColorCode lc = static_cast<ColorCode>(i);
1995 string const col = lcolor.getAllX11HexNames(lc).first;
1996 string const darkcol = lcolor.getAllX11HexNames(lc).second;
1997 if (ignore_system_lyxrc
1998 || col != system_lcolor.getAllX11HexNames(lc).first
1999 || darkcol != system_lcolor.getAllX11HexNames(lc).second) {
2000 os << "\\set_color \""
2001 << lcolor.getLyXName(lc) << "\" \""
2003 << darkcol << "\"\n";
2010 << "# PRINTER SECTION ###################################\n"
2014 case RC_PRINTLANDSCAPEFLAG:
2015 if (ignore_system_lyxrc ||
2016 print_landscape_flag != system_lyxrc.print_landscape_flag) {
2017 os << "\\print_landscape_flag \"" << print_landscape_flag
2023 case RC_PRINTPAPERFLAG:
2024 if (ignore_system_lyxrc ||
2025 print_paper_flag != system_lyxrc.print_paper_flag) {
2026 os << "\\print_paper_flag \"" << print_paper_flag
2032 case RC_PRINTPAPERDIMENSIONFLAG:
2033 if (ignore_system_lyxrc ||
2034 print_paper_dimension_flag
2035 != system_lyxrc.print_paper_dimension_flag) {
2036 os << "\\print_paper_dimension_flag \""
2037 << print_paper_dimension_flag << "\"\n";
2043 << "# TEX SECTION #######################################\n"
2047 case RC_TEXINPUTS_PREFIX:
2048 if (ignore_system_lyxrc ||
2049 texinputs_prefix != system_lyxrc.texinputs_prefix) {
2050 os << "\\texinputs_prefix \"" << texinputs_prefix << "\"\n";
2056 << "# FILE SECTION ######################################\n"
2059 case RC_DOCUMENTPATH:
2060 if (ignore_system_lyxrc ||
2061 document_path != system_lyxrc.document_path) {
2062 string const path = os::external_path(document_path);
2063 os << "\\document_path \"" << path << "\"\n";
2068 case RC_USELASTFILEPOS:
2069 if (ignore_system_lyxrc ||
2070 use_lastfilepos != system_lyxrc.use_lastfilepos) {
2071 os << "\\use_lastfilepos " << convert<string>(use_lastfilepos)
2077 case RC_LOADSESSION:
2078 if (ignore_system_lyxrc ||
2079 load_session != system_lyxrc.load_session) {
2080 os << "\\load_session " << convert<string>(load_session)
2086 case RC_MOUSE_WHEEL_SPEED:
2087 if (ignore_system_lyxrc ||
2088 mouse_wheel_speed != system_lyxrc.mouse_wheel_speed) {
2089 os << "\\mouse_wheel_speed " << mouse_wheel_speed << '\n';
2094 case RC_MOUSE_MIDDLEBUTTON_PASTE:
2095 if (ignore_system_lyxrc ||
2096 mouse_middlebutton_paste != system_lyxrc.mouse_middlebutton_paste) {
2097 os << "\\mouse_middlebutton_paste "
2098 << convert<string>(mouse_middlebutton_paste) << '\n';
2103 case RC_COMPLETION_INLINE_DELAY:
2104 if (ignore_system_lyxrc ||
2105 completion_inline_delay != system_lyxrc.completion_inline_delay) {
2106 os << "\\completion_inline_delay " << completion_inline_delay << '\n';
2111 case RC_COMPLETION_INLINE_MATH:
2112 if (ignore_system_lyxrc ||
2113 completion_inline_math != system_lyxrc.completion_inline_math) {
2114 os << "\\completion_inline_math "
2115 << convert<string>(completion_inline_math) << '\n';
2120 case RC_COMPLETION_INLINE_TEXT:
2121 if (ignore_system_lyxrc ||
2122 completion_inline_text != system_lyxrc.completion_inline_text) {
2123 os << "\\completion_inline_text "
2124 << convert<string>(completion_inline_text) << '\n';
2129 case RC_COMPLETION_INLINE_DOTS:
2130 if (ignore_system_lyxrc ||
2131 completion_inline_dots != system_lyxrc.completion_inline_dots) {
2132 os << "\\completion_inline_dots "
2133 << convert<string>(completion_inline_dots) << '\n';
2138 case RC_AUTOCORRECTION_MATH:
2139 if (ignore_system_lyxrc ||
2140 autocorrection_math != system_lyxrc.autocorrection_math) {
2141 os << "\\autocorrection_math "
2142 << convert<string>(autocorrection_math) << '\n';
2147 case RC_COMPLETION_POPUP_DELAY:
2148 if (ignore_system_lyxrc ||
2149 completion_popup_delay != system_lyxrc.completion_popup_delay) {
2150 os << "\\completion_popup_delay " << completion_popup_delay << '\n';
2155 case RC_COMPLETION_POPUP_MATH:
2156 if (ignore_system_lyxrc ||
2157 completion_popup_math != system_lyxrc.completion_popup_math) {
2158 os << "\\completion_popup_math "
2159 << convert<string>(completion_popup_math) << '\n';
2164 case RC_COMPLETION_POPUP_TEXT:
2165 if (ignore_system_lyxrc ||
2166 completion_popup_text != system_lyxrc.completion_popup_text) {
2167 os << "\\completion_popup_text "
2168 << convert<string>(completion_popup_text) << '\n';
2173 case RC_COMPLETION_CURSOR_TEXT:
2174 if (ignore_system_lyxrc ||
2175 completion_cursor_text != system_lyxrc.completion_cursor_text) {
2176 os << "\\completion_cursor_text "
2177 << convert<string>(completion_cursor_text) << '\n';
2182 case RC_COMPLETION_POPUP_AFTER_COMPLETE:
2183 if (ignore_system_lyxrc ||
2184 completion_popup_after_complete
2185 != system_lyxrc.completion_popup_after_complete) {
2186 os << "\\completion_popup_after_complete "
2187 << convert<string>(completion_popup_after_complete) << '\n';
2192 case RC_COMPLETION_MINLENGTH:
2193 if (ignore_system_lyxrc ||
2194 completion_minlength != system_lyxrc.completion_minlength) {
2195 os << "\\completion_minlength " << convert<string>(completion_minlength)
2201 case RC_NUMLASTFILES:
2202 if (ignore_system_lyxrc ||
2203 num_lastfiles != system_lyxrc.num_lastfiles) {
2204 os << "\\num_lastfiles " << num_lastfiles << '\n';
2209 case RC_CHECKLASTFILES:
2210 if (ignore_system_lyxrc ||
2211 check_lastfiles != system_lyxrc.check_lastfiles) {
2212 os << "\\check_lastfiles " << convert<string>(check_lastfiles)
2218 case RC_EXAMPLEPATH:
2219 if (ignore_system_lyxrc ||
2220 example_path != system_lyxrc.example_path) {
2221 string const path = os::external_path(example_path);
2222 os << "\\example_path \"" << path << "\"\n";
2227 case RC_TEMPLATEPATH:
2228 if (ignore_system_lyxrc ||
2229 template_path != system_lyxrc.template_path) {
2230 string const path = os::external_path(template_path);
2231 os << "\\template_path \"" << path << "\"\n";
2236 case RC_TEMPDIRPATH:
2237 if (ignore_system_lyxrc ||
2238 tempdir_path != system_lyxrc.tempdir_path) {
2239 string const path = os::external_path(tempdir_path);
2240 os << "\\tempdir_path \"" << path << "\"\n";
2245 case RC_THESAURUSDIRPATH:
2246 if (ignore_system_lyxrc ||
2247 thesaurusdir_path != system_lyxrc.thesaurusdir_path) {
2248 string const path = os::external_path(thesaurusdir_path);
2249 os << "\\thesaurusdir_path \"" << path << "\"\n";
2254 case RC_HUNSPELLDIR_PATH:
2255 if (ignore_system_lyxrc ||
2256 hunspelldir_path != system_lyxrc.hunspelldir_path) {
2257 string const path = os::external_path(hunspelldir_path);
2258 os << "\\hunspelldir_path \"" << path << "\"\n";
2263 case RC_PLAINTEXT_LINELEN:
2264 if (ignore_system_lyxrc ||
2265 plaintext_linelen != system_lyxrc.plaintext_linelen) {
2266 os << "\\plaintext_linelen " << plaintext_linelen << '\n';
2271 case RC_MAKE_BACKUP:
2272 if (ignore_system_lyxrc ||
2273 make_backup != system_lyxrc.make_backup) {
2274 os << "\\make_backup " << convert<string>(make_backup) << '\n';
2279 case RC_SAVE_COMPRESSED:
2280 if (ignore_system_lyxrc ||
2281 save_compressed != system_lyxrc.save_compressed) {
2282 os << "\\save_compressed " << convert<string>(save_compressed) << '\n';
2287 case RC_SAVE_ORIGIN:
2288 if (ignore_system_lyxrc ||
2289 save_origin != system_lyxrc.save_origin) {
2290 os << "\\save_origin " << convert<string>(save_origin) << '\n';
2295 case RC_BACKUPDIR_PATH:
2296 if (ignore_system_lyxrc ||
2297 backupdir_path != system_lyxrc.backupdir_path) {
2298 string const path = os::external_path(backupdir_path);
2299 os << "\\backupdir_path \"" << path << "\"\n";
2305 << "# PLAIN TEXT EXPORT SECTION ##############################\n"
2309 << "# SPELLCHECKER SECTION ##############################\n"
2313 case RC_ACCEPT_COMPOUND:
2314 if (ignore_system_lyxrc ||
2315 spellchecker_accept_compound != system_lyxrc.spellchecker_accept_compound) {
2316 os << "\\accept_compound " << convert<string>(spellchecker_accept_compound)
2323 if (ignore_system_lyxrc ||
2324 spellchecker_alt_lang != system_lyxrc.spellchecker_alt_lang) {
2325 os << "\\alternate_language \"" << spellchecker_alt_lang
2332 if (ignore_system_lyxrc ||
2333 spellchecker_esc_chars != system_lyxrc.spellchecker_esc_chars) {
2334 os << "\\escape_chars \"" << spellchecker_esc_chars << "\"\n";
2339 case RC_USE_NATIVE_FILEDIALOG:
2340 if (ignore_system_lyxrc ||
2341 use_native_filedialog != system_lyxrc.use_native_filedialog) {
2342 os << "\\use_native_filedialog "
2343 << convert<string>(use_native_filedialog)
2349 case RC_USE_SYSTEM_COLORS:
2350 if (ignore_system_lyxrc ||
2351 use_system_colors != system_lyxrc.use_system_colors) {
2352 os << "\\use_system_colors "
2353 << convert<string>(use_system_colors)
2359 case RC_USE_TOOLTIP:
2360 if (ignore_system_lyxrc ||
2361 use_tooltip != system_lyxrc.use_tooltip) {
2362 os << "\\use_tooltip "
2363 << convert<string>(use_tooltip)
2371 << "# LANGUAGE SUPPORT SECTION ##########################\n"
2375 case RC_DEFAULT_DECIMAL_SEP:
2376 if (ignore_system_lyxrc ||
2377 default_decimal_sep != system_lyxrc.default_decimal_sep) {
2378 os << "\\default_decimal_point \"" << default_decimal_sep << "\"" << '\n';
2383 case RC_DEFAULT_LENGTH_UNIT:
2384 if (ignore_system_lyxrc ||
2385 default_length_unit != system_lyxrc.default_length_unit) {
2386 os << "\\default_length_unit " << int(default_length_unit) << '\n';
2391 case RC_SPELLCHECKER:
2392 if (ignore_system_lyxrc ||
2393 spellchecker != system_lyxrc.spellchecker) {
2394 os << "\\spellchecker " << spellchecker << '\n';
2399 case RC_SPELLCHECK_CONTINUOUSLY:
2400 if (ignore_system_lyxrc ||
2401 spellcheck_continuously != system_lyxrc.spellcheck_continuously) {
2402 os << "\\spellcheck_continuously " << convert<string>(spellcheck_continuously)
2408 case RC_SPELLCHECK_NOTES:
2409 if (ignore_system_lyxrc ||
2410 spellcheck_notes != system_lyxrc.spellcheck_notes) {
2411 os << "\\spellcheck_notes " << convert<string>(spellcheck_notes)
2417 case RC_VISUAL_CURSOR:
2418 if (ignore_system_lyxrc ||
2419 visual_cursor != system_lyxrc.visual_cursor) {
2420 os << "\\visual_cursor " << convert<string>(visual_cursor) << '\n';
2425 case RC_CLOSE_BUFFER_WITH_LAST_VIEW:
2426 if (ignore_system_lyxrc ||
2427 close_buffer_with_last_view != system_lyxrc.close_buffer_with_last_view) {
2428 os << "# When closing last view, buffer closes (yes), hides (no), or ask the user (ask)\n";
2429 os << "\\close_buffer_with_last_view " << close_buffer_with_last_view << '\n';
2434 case RC_LANGUAGE_CUSTOM_PACKAGE:
2435 if (ignore_system_lyxrc ||
2436 language_custom_package != system_lyxrc.language_custom_package) {
2437 os << "\\language_custom_package \"" << language_custom_package
2443 case RC_LANGUAGE_GLOBAL_OPTIONS:
2444 if (ignore_system_lyxrc ||
2445 language_global_options
2446 != system_lyxrc.language_global_options) {
2447 os << "\\language_global_options \""
2448 << convert<string>(language_global_options)
2454 case RC_LANGUAGE_PACKAGE_SELECTION:
2455 if (ignore_system_lyxrc ||
2456 language_package_selection != system_lyxrc.language_package_selection) {
2457 os << "\\language_package_selection ";
2458 switch (language_package_selection) {
2476 case RC_LANGUAGE_COMMAND_BEGIN:
2477 if (ignore_system_lyxrc ||
2478 language_command_begin
2479 != system_lyxrc.language_command_begin) {
2480 os << "\\language_command_begin \""
2481 << language_command_begin
2487 case RC_LANGUAGE_COMMAND_END:
2488 if (ignore_system_lyxrc ||
2489 language_command_end
2490 != system_lyxrc.language_command_end) {
2491 os << "\\language_command_end \"" << language_command_end
2497 case RC_LANGUAGE_COMMAND_LOCAL:
2498 if (ignore_system_lyxrc ||
2499 language_command_local
2500 != system_lyxrc.language_command_local) {
2501 os << "\\language_command_local \""
2502 << language_command_local
2508 case RC_LANGUAGE_AUTO_BEGIN:
2509 if (ignore_system_lyxrc ||
2510 language_auto_begin != system_lyxrc.language_auto_begin) {
2511 os << "\\language_auto_begin "
2512 << convert<string>(language_auto_begin) << '\n';
2517 case RC_LANGUAGE_AUTO_END:
2518 if (ignore_system_lyxrc ||
2519 language_auto_end != system_lyxrc.language_auto_end) {
2520 os << "\\language_auto_end "
2521 << convert<string>(language_auto_end) << '\n';
2526 case RC_MARK_FOREIGN_LANGUAGE:
2527 if (ignore_system_lyxrc ||
2528 mark_foreign_language
2529 != system_lyxrc.mark_foreign_language) {
2530 os << "\\mark_foreign_language " <<
2531 convert<string>(mark_foreign_language) << '\n';
2534 case RC_RESPECT_OS_KBD_LANGUAGE:
2535 if (ignore_system_lyxrc ||
2536 respect_os_kbd_language
2537 != system_lyxrc.respect_os_kbd_language) {
2538 os << "\\respect_os_kbd_language " <<
2539 convert<string>(respect_os_kbd_language) << '\n';
2546 << "# 2nd MISC SUPPORT SECTION ##########################\n"
2550 case RC_AUTO_NUMBER:
2551 if (ignore_system_lyxrc ||
2552 auto_number != system_lyxrc.auto_number) {
2553 os << "\\auto_number " << convert<string>(auto_number) << '\n';
2558 case RC_GUI_LANGUAGE:
2559 if (ignore_system_lyxrc ||
2560 gui_language != system_lyxrc.gui_language) {
2561 os << "\\gui_language " << gui_language << '\n';
2566 case RC_EXPORT_OVERWRITE:
2567 if (ignore_system_lyxrc ||
2568 export_overwrite != system_lyxrc.export_overwrite) {
2570 switch (export_overwrite) {
2581 os << "\\export_overwrite " << status << '\n';
2586 case RC_SCROLL_WHEEL_ZOOM:
2587 if (ignore_system_lyxrc ||
2588 scroll_wheel_zoom != system_lyxrc.scroll_wheel_zoom) {
2590 switch (scroll_wheel_zoom) {
2591 case SCROLL_WHEEL_ZOOM_OFF:
2594 case SCROLL_WHEEL_ZOOM_CTRL:
2597 case SCROLL_WHEEL_ZOOM_SHIFT:
2600 case SCROLL_WHEEL_ZOOM_ALT:
2604 os << "\\scroll_wheel_zoom " << status << '\n';
2610 << "# FORMATS SECTION ##########################\n"
2615 // New/modified formats
2616 for (Formats::const_iterator cit = theFormats().begin();
2617 cit != theFormats().end(); ++cit) {
2618 Format const * format =
2619 theSystemFormats().getFormat(cit->name());
2621 format->extensions() != cit->extensions() ||
2622 format->prettyname() != cit->prettyname() ||
2623 format->shortcut() != cit->shortcut() ||
2624 format->viewer() != cit->viewer() ||
2625 format->editor() != cit->editor() ||
2626 format->documentFormat() != cit->documentFormat() ||
2627 format->vectorFormat() != cit->vectorFormat() ||
2628 format->inExportMenu() != cit->inExportMenu() ||
2629 format->noMenu() != cit->noMenu() ||
2630 format->mime() != cit->mime()) {
2631 os << "\\format \"" << cit->name() << "\" \""
2632 << cit->extensions() << "\" \""
2633 << to_utf8(cit->prettyname()) << "\" \""
2634 << cit->shortcut() << "\" \""
2635 << escapeCommand(cit->viewer()) << "\" \""
2636 << escapeCommand(cit->editor()) << "\" \"";
2637 vector<string> flags;
2638 if (cit->documentFormat())
2639 flags.push_back("document");
2640 if (cit->vectorFormat())
2641 flags.push_back("vector");
2642 if (cit->zippedNative())
2643 flags.push_back("zipped=native");
2644 if (cit->inExportMenu())
2645 flags.push_back("menu=export");
2647 os << getStringFromVector(flags);
2648 os << "\" \"" << cit->mime() << "\"\n";
2652 // Look for deleted formats
2653 for (Formats::const_iterator cit = theSystemFormats().begin();
2654 cit != theSystemFormats().end(); ++cit)
2655 if (!theFormats().getFormat(cit->name()))
2656 os << "\\format \"" << cit->name()
2657 << "\" \"\" \"\" \"\" \"\" \"\" \"\" \"\"\n";
2661 case RC_VIEWER_ALTERNATIVES: {
2662 Alternatives::const_iterator it = viewer_alternatives.begin();
2663 Alternatives::const_iterator const en = viewer_alternatives.end();
2664 Alternatives::const_iterator const sysend =
2665 system_lyxrc.viewer_alternatives.end();
2666 for (; it != en; ++it) {
2667 string const & fmt = it->first;
2668 CommandSet const & cmd = it->second;
2669 CommandSet::const_iterator sit = cmd.begin();
2670 CommandSet::const_iterator const sen = cmd.end();
2671 Alternatives::const_iterator const sysfmt = ignore_system_lyxrc ?
2672 system_lyxrc.viewer_alternatives.begin() : // we won't use it in this case
2673 system_lyxrc.viewer_alternatives.find(fmt);
2674 for (; sit != sen; ++sit) {
2675 string const & cmd = *sit;
2676 if (ignore_system_lyxrc
2677 || sysfmt == sysend // format not found
2678 || sysfmt->second.count(cmd) == 0 // this command not found
2680 os << "\\viewer_alternatives " << fmt << " \"" << escapeCommand(cmd) << "\"\n";
2687 case RC_EDITOR_ALTERNATIVES: {
2688 Alternatives::const_iterator it = editor_alternatives.begin();
2689 Alternatives::const_iterator const en = editor_alternatives.end();
2690 Alternatives::const_iterator const sysend =
2691 system_lyxrc.editor_alternatives.end();
2692 for (; it != en; ++it) {
2693 string const & fmt = it->first;
2694 CommandSet const & cmd = it->second;
2695 CommandSet::const_iterator sit = cmd.begin();
2696 CommandSet::const_iterator const sen = cmd.end();
2697 Alternatives::const_iterator const sysfmt = ignore_system_lyxrc ?
2698 system_lyxrc.editor_alternatives.begin() : // we won't use it in this case
2699 system_lyxrc.editor_alternatives.find(fmt);
2700 for (; sit != sen; ++sit) {
2701 string const & cmd = *sit;
2702 if (ignore_system_lyxrc
2703 || sysfmt == sysend // format not found
2704 || sysfmt->second.count(cmd) == 0 // this command not found
2706 os << "\\editor_alternatives " << fmt << " \"" << escapeCommand(cmd) << "\"\n";
2713 case RC_DEFAULT_OTF_VIEW_FORMAT:
2714 if ((ignore_system_lyxrc ||
2715 default_otf_view_format != system_lyxrc.default_otf_view_format)
2716 && !default_otf_view_format.empty()) {
2717 os << "\\default_otf_view_format " << default_otf_view_format << '\n';
2722 case RC_DEFAULT_PLATEX_VIEW_FORMAT:
2723 if ((ignore_system_lyxrc ||
2724 default_platex_view_format != system_lyxrc.default_platex_view_format)
2725 && !default_platex_view_format.empty()) {
2726 os << "\\default_platex_view_format " << default_platex_view_format << '\n';
2731 case RC_DEFAULT_VIEW_FORMAT:
2732 if ((ignore_system_lyxrc ||
2733 default_view_format != system_lyxrc.default_view_format)
2734 && !default_view_format.empty()) {
2735 os << "\\default_view_format " << default_view_format << '\n';
2746 << "# CONVERTERS SECTION ##########################\n"
2751 // Look for new converters
2752 for (Converters::const_iterator cit = theConverters().begin();
2753 cit != theConverters().end(); ++cit) {
2754 Converter const * converter =
2755 theSystemConverters().getConverter(cit->from(),
2758 converter->command() != cit->command() ||
2759 converter->flags() != cit->flags())
2760 os << "\\converter \"" << cit->from() << "\" \""
2761 << cit->to() << "\" \""
2762 << escapeCommand(cit->command()) << "\" \""
2763 << cit->flags() << "\"\n";
2766 // New/modifed converters
2767 for (Converters::const_iterator cit = theSystemConverters().begin();
2768 cit != theSystemConverters().end(); ++cit)
2769 if (!theConverters().getConverter(cit->from(), cit->to()))
2770 os << "\\converter \"" << cit->from()
2771 << "\" \"" << cit->to() << "\" \"\" \"\"\n";
2778 << "# COPIERS SECTION ##########################\n"
2781 // Look for new movers
2782 Movers::const_iterator const sysbegin = theSystemMovers().begin();
2783 Movers::const_iterator const sysend = theSystemMovers().end();
2784 Movers::const_iterator it = theMovers().begin();
2785 Movers::const_iterator end = theMovers().end();
2787 for (; it != end; ++it) {
2788 Movers::const_iterator const sysit =
2789 find_if(sysbegin, sysend, SameMover(*it));
2790 if (sysit == sysend) {
2791 string const & fmt = it->first;
2792 string const & command =
2793 it->second.command();
2795 os << "\\copier " << fmt
2796 << " \"" << escapeCommand(command) << "\"\n";
2802 // We don't actually delete SpecialisedMover(s) from the
2803 // map, just clear their 'command', so there's no need
2804 // to test for anything else.
2811 void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new)
2813 // Why the switch you might ask. It is a trick to ensure that all
2814 // the elements in the LyXRCTags enum is handled. As you can see
2815 // there are no breaks at all. So it is just a huge fall-through.
2816 // The nice thing is that we will get a warning from the compiler
2817 // if we forget an element.
2818 LyXRC::LyXRCTags tag = LyXRC::RC_LAST;
2820 case LyXRC::RC_LAST:
2821 case LyXRC::RC_ACCEPT_COMPOUND:
2822 if (lyxrc_orig.spellchecker_accept_compound != lyxrc_new.spellchecker_accept_compound)
2823 if (theSpellChecker()) theSpellChecker()->advanceChangeNumber();
2825 case LyXRC::RC_ALT_LANG:
2826 case LyXRC::RC_PLAINTEXT_LINELEN:
2827 case LyXRC::RC_AUTOCORRECTION_MATH:
2828 case LyXRC::RC_AUTOREGIONDELETE:
2829 case LyXRC::RC_AUTORESET_OPTIONS:
2830 case LyXRC::RC_AUTOSAVE:
2831 case LyXRC::RC_AUTO_NUMBER:
2832 case LyXRC::RC_BACKUPDIR_PATH:
2833 case LyXRC::RC_BIBTEX_ALTERNATIVES:
2834 case LyXRC::RC_BIBTEX_COMMAND:
2835 case LyXRC::RC_BINDFILE:
2836 case LyXRC::RC_CITATION_SEARCH:
2837 case LyXRC::RC_CITATION_SEARCH_PATTERN:
2838 case LyXRC::RC_CITATION_SEARCH_VIEW:
2839 case LyXRC::RC_CHECKLASTFILES:
2840 case LyXRC::RC_COMPLETION_CURSOR_TEXT:
2841 case LyXRC::RC_COMPLETION_INLINE_DELAY:
2842 case LyXRC::RC_COMPLETION_INLINE_DOTS:
2843 case LyXRC::RC_COMPLETION_INLINE_MATH:
2844 case LyXRC::RC_COMPLETION_INLINE_TEXT:
2845 case LyXRC::RC_COMPLETION_POPUP_AFTER_COMPLETE:
2846 case LyXRC::RC_COMPLETION_POPUP_DELAY:
2847 case LyXRC::RC_COMPLETION_POPUP_MATH:
2848 case LyXRC::RC_COMPLETION_POPUP_TEXT:
2849 case LyXRC::RC_COMPLETION_MINLENGTH:
2850 case LyXRC::RC_USELASTFILEPOS:
2851 case LyXRC::RC_LOADSESSION:
2852 case LyXRC::RC_CHKTEX_COMMAND:
2853 case LyXRC::RC_CONVERTER:
2854 case LyXRC::RC_CONVERTER_CACHE_MAXAGE:
2855 case LyXRC::RC_COPIER:
2856 case LyXRC::RC_CT_ADDITIONS_UNDERLINED:
2857 case LyXRC::RC_CT_MARKUP_COPIED:
2858 case LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR:
2859 case LyXRC::RC_SCROLL_BELOW_DOCUMENT:
2860 case LyXRC::RC_GUI_LANGUAGE:
2861 case LyXRC::RC_DEFAULT_OTF_VIEW_FORMAT:
2862 case LyXRC::RC_DEFAULT_PLATEX_VIEW_FORMAT:
2863 case LyXRC::RC_DEFAULT_VIEW_FORMAT:
2864 case LyXRC::RC_DEFFILE:
2865 case LyXRC::RC_DIALOGS_ICONIFY_WITH_MAIN:
2866 case LyXRC::RC_DISPLAY_GRAPHICS:
2867 case LyXRC::RC_DOCUMENTPATH:
2868 if (lyxrc_orig.document_path != lyxrc_new.document_path) {
2869 FileName path(lyxrc_new.document_path);
2870 if (path.exists() && path.isDirectory())
2871 package().document_dir() = FileName(lyxrc.document_path);
2874 case LyXRC::RC_EDITOR_ALTERNATIVES:
2875 case LyXRC::RC_ESC_CHARS:
2876 case LyXRC::RC_EXAMPLEPATH:
2877 case LyXRC::RC_FILEFORMAT:
2878 case LyXRC::RC_GROUP_LAYOUTS:
2879 case LyXRC::RC_HUNSPELLDIR_PATH:
2880 case LyXRC::RC_ICON_SET:
2881 case LyXRC::RC_INDEX_ALTERNATIVES:
2882 case LyXRC::RC_INDEX_COMMAND:
2883 case LyXRC::RC_JBIBTEX_COMMAND:
2884 case LyXRC::RC_JBIBTEX_ALTERNATIVES:
2885 case LyXRC::RC_JINDEX_COMMAND:
2886 case LyXRC::RC_NOMENCL_COMMAND:
2887 case LyXRC::RC_PYGMENTIZE_COMMAND:
2888 case LyXRC::RC_INPUT:
2889 case LyXRC::RC_KBMAP:
2890 case LyXRC::RC_KBMAP_PRIMARY:
2891 case LyXRC::RC_KBMAP_SECONDARY:
2892 case LyXRC::RC_LANGUAGE_AUTO_BEGIN:
2893 case LyXRC::RC_LANGUAGE_AUTO_END:
2894 case LyXRC::RC_LANGUAGE_COMMAND_BEGIN:
2895 case LyXRC::RC_LANGUAGE_COMMAND_END:
2896 case LyXRC::RC_LANGUAGE_COMMAND_LOCAL:
2897 case LyXRC::RC_LANGUAGE_GLOBAL_OPTIONS:
2898 case LyXRC::RC_LANGUAGE_CUSTOM_PACKAGE:
2899 case LyXRC::RC_LANGUAGE_PACKAGE_SELECTION:
2900 case LyXRC::RC_LYXRCFORMAT:
2901 case LyXRC::RC_MAC_DONTSWAP_CTRL_META:
2902 case LyXRC::RC_MAC_LIKE_CURSOR_MOVEMENT:
2903 case LyXRC::RC_MACRO_EDIT_STYLE:
2904 case LyXRC::RC_MAKE_BACKUP:
2905 case LyXRC::RC_MARK_FOREIGN_LANGUAGE:
2906 case LyXRC::RC_RESPECT_OS_KBD_LANGUAGE:
2907 case LyXRC::RC_MOUSE_WHEEL_SPEED:
2908 case LyXRC::RC_MOUSE_MIDDLEBUTTON_PASTE:
2909 case LyXRC::RC_NUMLASTFILES:
2910 case LyXRC::RC_PARAGRAPH_MARKERS:
2911 case LyXRC::RC_PATH_PREFIX:
2912 if (lyxrc_orig.path_prefix != lyxrc_new.path_prefix) {
2913 prependEnvPath("PATH", replaceEnvironmentPath(lyxrc_new.path_prefix));
2914 // Resets python path
2915 support::os::python(true);
2918 case LyXRC::RC_PREVIEW:
2919 if (lyxrc_orig.preview != lyxrc_new.preview) {
2920 // Update all previews of all documents.
2921 /* FIXME: this can be very expensive. It would be cheaper
2922 * to kill all existing previews and update visible
2924 theBufferList().updatePreviews();
2927 case LyXRC::RC_PREVIEW_HASHED_LABELS:
2928 case LyXRC::RC_PREVIEW_SCALE_FACTOR:
2929 case LyXRC::RC_PRINTLANDSCAPEFLAG:
2930 case LyXRC::RC_PRINTPAPERDIMENSIONFLAG:
2931 case LyXRC::RC_PRINTPAPERFLAG:
2932 case LyXRC::RC_SAVE_COMPRESSED:
2933 case LyXRC::RC_SAVE_ORIGIN:
2934 case LyXRC::RC_SCREEN_DPI:
2936 case LyXRC::RC_SCREEN_FONT_ROMAN:
2937 case LyXRC::RC_SCREEN_FONT_ROMAN_FOUNDRY:
2938 case LyXRC::RC_SCREEN_FONT_SANS:
2939 case LyXRC::RC_SCREEN_FONT_SANS_FOUNDRY:
2940 case LyXRC::RC_SCREEN_FONT_SCALABLE:
2941 case LyXRC::RC_SCREEN_FONT_SIZES:
2942 case LyXRC::RC_SCREEN_FONT_TYPEWRITER:
2943 case LyXRC::RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
2944 case LyXRC::RC_SCREEN_ZOOM:
2945 if (lyxrc_orig.roman_font_name != lyxrc_new.roman_font_name
2946 || lyxrc_orig.sans_font_name != lyxrc_new.sans_font_name
2947 || lyxrc_orig.typewriter_font_name != lyxrc_new.typewriter_font_name
2948 || lyxrc_orig.roman_font_foundry != lyxrc_new.roman_font_foundry
2949 || lyxrc_orig.sans_font_foundry != lyxrc_new.sans_font_foundry
2950 || lyxrc_orig.use_scalable_fonts != lyxrc_new.use_scalable_fonts
2951 || !std::equal(std::begin(lyxrc_orig.font_sizes), std::end(lyxrc_orig.font_sizes),
2952 std::begin(lyxrc_new.font_sizes))
2953 || lyxrc_orig.typewriter_font_foundry != lyxrc_new.typewriter_font_foundry
2954 || lyxrc_orig.defaultZoom != lyxrc_new.defaultZoom) {
2955 dispatch(FuncRequest(LFUN_SCREEN_FONT_UPDATE));
2958 case LyXRC::RC_GEOMETRY_SESSION:
2959 case LyXRC::RC_SERVERPIPE:
2960 case LyXRC::RC_SET_COLOR:
2961 case LyXRC::RC_SHOW_BANNER:
2962 case LyXRC::RC_OPEN_BUFFERS_IN_TABS:
2963 case LyXRC::RC_SPELLCHECKER:
2964 if (lyxrc_orig.spellchecker != lyxrc_new.spellchecker)
2967 case LyXRC::RC_SPELLCHECK_CONTINUOUSLY:
2968 case LyXRC::RC_SPELLCHECK_NOTES:
2969 case LyXRC::RC_SPLITINDEX_COMMAND:
2970 case LyXRC::RC_TEMPDIRPATH:
2971 case LyXRC::RC_TEMPLATEPATH:
2972 case LyXRC::RC_TEX_ALLOWS_SPACES:
2973 case LyXRC::RC_TEX_EXPECTS_WINDOWS_PATHS:
2974 if (lyxrc_orig.windows_style_tex_paths != lyxrc_new.windows_style_tex_paths) {
2975 os::windows_style_tex_paths(lyxrc_new.windows_style_tex_paths);
2978 case LyXRC::RC_TEXINPUTS_PREFIX:
2979 case LyXRC::RC_THESAURUSDIRPATH:
2980 case LyXRC::RC_UIFILE:
2981 case LyXRC::RC_USER_EMAIL:
2982 case LyXRC::RC_USER_INITIALS:
2983 case LyXRC::RC_USER_NAME:
2984 case LyXRC::RC_USE_CONVERTER_CACHE:
2985 case LyXRC::RC_USE_CONVERTER_NEEDAUTH_FORBIDDEN:
2986 case LyXRC::RC_USE_CONVERTER_NEEDAUTH:
2987 case LyXRC::RC_USE_NATIVE_FILEDIALOG:
2988 case LyXRC::RC_USE_SYSTEM_COLORS:
2989 case LyXRC::RC_USE_TOOLTIP:
2990 case LyXRC::RC_USE_SYSTEM_THEME_ICONS:
2991 case LyXRC::RC_VIEWDVI_PAPEROPTION:
2992 case LyXRC::RC_SINGLE_CLOSE_TAB_BUTTON:
2993 case LyXRC::RC_SINGLE_INSTANCE:
2994 case LyXRC::RC_SORT_LAYOUTS:
2995 case LyXRC::RC_FULL_SCREEN_LIMIT:
2996 case LyXRC::RC_FULL_SCREEN_SCROLLBAR:
2997 case LyXRC::RC_FULL_SCREEN_MENUBAR:
2998 case LyXRC::RC_FULL_SCREEN_STATUSBAR:
2999 case LyXRC::RC_FULL_SCREEN_TABBAR:
3000 case LyXRC::RC_FULL_SCREEN_TOOLBARS:
3001 case LyXRC::RC_FULL_SCREEN_WIDTH:
3002 case LyXRC::RC_VISUAL_CURSOR:
3003 case LyXRC::RC_CLOSE_BUFFER_WITH_LAST_VIEW:
3004 case LyXRC::RC_VIEWER:
3005 case LyXRC::RC_VIEWER_ALTERNATIVES:
3006 case LyXRC::RC_FORWARD_SEARCH_DVI:
3007 case LyXRC::RC_FORWARD_SEARCH_PDF:
3008 case LyXRC::RC_EXPORT_OVERWRITE:
3009 case LyXRC::RC_DEFAULT_DECIMAL_SEP:
3010 case LyXRC::RC_DEFAULT_LENGTH_UNIT:
3011 case LyXRC::RC_SCROLL_WHEEL_ZOOM:
3012 case LyXRC::RC_CURSOR_WIDTH:
3018 set<string> LyXRC::getRCs()
3021 for (int i = 0; i != lyxrcCount; ++i)
3022 res.insert(ltrim(lyxrcTags[i].tag, "\\"));
3028 string const LyXRC::getDescription(LyXRCTags tag)
3033 case RC_ACCEPT_COMPOUND:
3034 str = _("Consider run-together words, such as \"diskdrive\" for \"disk drive\", as legal words?");
3038 str = _("Specify an alternate language. The default is to use the language of the document.");
3041 case RC_PLAINTEXT_LINELEN:
3042 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.");
3045 case RC_AUTOREGIONDELETE:
3046 str = _("De-select if you don't want the current selection to be replaced automatically by what you type.");
3049 case RC_AUTORESET_OPTIONS:
3050 str = _("De-select if you don't want the class options to be reset to defaults after class change.");
3054 str = _("The time interval between auto-saves (in seconds). 0 means no auto-save.");
3057 case RC_AUTO_NUMBER:
3060 case RC_BACKUPDIR_PATH:
3061 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.");
3064 case RC_BIBTEX_COMMAND:
3065 str = _("Define the options of bibtex (cf. man bibtex) or select an alternative compiler (e.g. mlbibtex or bibulus).");
3068 case RC_JBIBTEX_COMMAND:
3069 str = _("Define the options of the bibtex program for PLaTeX (Japanese LaTeX).");
3073 str = _("Keybindings file. Can either specify an absolute path, or LyX will look in its global and local bind/ directories.");
3076 case RC_CHECKLASTFILES:
3077 str = _("Select to check whether the lastfiles still exist.");
3080 case RC_CHKTEX_COMMAND:
3081 str = _("Define how to run chktex. E.g. \"chktex -n11 -n1 -n3 -n6 -n9 -22 -n25 -n30 -n38\" Refer to the ChkTeX documentation.");
3087 case RC_CONVERTER_NEEDAUTH_FORBIDDEN:
3088 str = _("Forbid use of external converters with 'needauth' option to prevent undesired effects.");
3091 case RC_CONVERTER_NEEDAUTH:
3092 str = _("Ask user before calling external converters with 'needauth' option to prevent undesired effects.");
3098 case RC_CURSOR_FOLLOWS_SCROLLBAR:
3099 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.");
3102 case RC_CURSOR_WIDTH:
3103 str = _("Configure the width of the text cursor. Automatic zoom-controlled cursor width used when set to 0.");
3106 case RC_SCROLL_BELOW_DOCUMENT:
3107 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");
3110 case RC_MAC_DONTSWAP_CTRL_META:
3111 str = _("Make Apple key act as Meta and Control key as Ctrl.");
3114 case RC_MAC_LIKE_CURSOR_MOVEMENT:
3115 str = _("Use the Mac OS X conventions for cursor movement");
3118 case RC_SHOW_MACRO_LABEL:
3119 str = _("Show a small box around a Math Macro with the macro name when the cursor is inside.");
3123 str = _("Command definition file. Can either specify an absolute path, or LyX will look in its global and local commands/ directories.");
3126 case RC_DEFAULT_OTF_VIEW_FORMAT:
3127 str = _("The default format used with LFUN_BUFFER_[VIEW|UPDATE] with non-TeX fonts.");
3130 case RC_DEFAULT_VIEW_FORMAT:
3131 str = _("The default format used with LFUN_BUFFER_[VIEW|UPDATE].");
3134 case RC_DIALOGS_ICONIFY_WITH_MAIN:
3135 str = _("Iconify the dialogs when the main window is iconified. (Affects only dialogs shown after the change has been made.)");
3138 case RC_DISPLAY_GRAPHICS:
3139 str = _("Select how LyX will display any graphics.");
3142 case RC_DOCUMENTPATH:
3143 str = _("The default path for your documents. An empty value selects the directory LyX was started from.");
3147 str = _("Specify additional chars that can be part of a word.");
3150 case RC_EXAMPLEPATH:
3151 str = _("The path that LyX will set when offering to choose an example. An empty value selects the directory LyX was started from.");
3157 case RC_INDEX_COMMAND:
3158 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\".");
3161 case RC_JINDEX_COMMAND:
3162 str = _("Define the options of the index program for PLaTeX (Japanese LaTeX).");
3165 case RC_NOMENCL_COMMAND:
3166 str = _("Define the options of makeindex (cf. man makeindex) to be used for nomenclatures. This might differ from the index processing options.");
3169 case RC_PYGMENTIZE_COMMAND:
3170 str = _("The command to run the python pygments syntax highlighter.");
3177 case RC_KBMAP_PRIMARY:
3178 case RC_KBMAP_SECONDARY:
3179 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.");
3182 case RC_LANGUAGE_AUTO_BEGIN:
3183 str = _("Select if a language switching command is needed at the beginning of the document.");
3186 case RC_LANGUAGE_AUTO_END:
3187 str = _("Select if a language switching command is needed at the end of the document.");
3190 case RC_LANGUAGE_COMMAND_BEGIN:
3191 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.");
3194 case RC_LANGUAGE_COMMAND_END:
3195 str = _("The LaTeX command for changing back to the language of the document.");
3198 case RC_LANGUAGE_COMMAND_LOCAL:
3199 str = _("The LaTeX command for local changing of the language.");
3202 case RC_LANGUAGE_GLOBAL_OPTIONS:
3203 str = _("De-select if you don't want the language(s) used as an argument to \\documentclass.");
3206 case RC_LANGUAGE_CUSTOM_PACKAGE:
3207 str = _("The LaTeX command for loading the language package. E.g. \"\\usepackage{babel}\", \"\\usepackage{omega}\".");
3210 case RC_LANGUAGE_PACKAGE_SELECTION:
3211 str = _("De-select if you don't want babel to be used when the language of the document is the default language.");
3214 case RC_USELASTFILEPOS:
3215 str = _("De-select if you do not want LyX to scroll to saved position.");
3218 case RC_LOADSESSION:
3219 str = _("De-select to prevent loading files opened from the last LyX session.");
3222 case RC_MAKE_BACKUP:
3223 str = _("De-select if you don't want LyX to create backup files.");
3226 case RC_MARK_FOREIGN_LANGUAGE:
3227 str = _("Select to control the highlighting of words with a language foreign to that of the document.");
3230 case RC_RESPECT_OS_KBD_LANGUAGE:
3231 str = _("Select to use the current keyboard language, as set from the operating system, as default input language.");
3234 case RC_MOUSE_WHEEL_SPEED:
3235 str = _("The scrolling speed of the mouse wheel.");
3238 case RC_COMPLETION_POPUP_DELAY:
3239 str = _("The completion popup delay.");
3242 case RC_COMPLETION_POPUP_MATH:
3243 str = _("Select to display the completion popup in math mode.");
3246 case RC_COMPLETION_POPUP_TEXT:
3247 str = _("Select to display the completion popup in text mode.");
3250 case RC_COMPLETION_POPUP_AFTER_COMPLETE:
3251 str = _("Show the completion popup without delay after non-unique completion attempt.");
3254 case RC_COMPLETION_POPUP_TEXT:
3255 str = _("Show a small triangle on the cursor to indicate that a completion is available.");
3258 case RC_COMPLETION_POPUP_DELAY:
3259 str = _("The inline completion delay.");
3262 case RC_COMPLETION_INLINE_MATH:
3263 str = _("Select to display the inline completion in math mode.");
3266 case RC_COMPLETION_INLINE_TEXT:
3267 str = _("Select to display the inline completion in text mode.");
3270 case RC_COMPLETION_INLINE_DOTS:
3271 str = _("Use \"...\" to shorten long completions.");
3274 case RC_AUTOCORRECTION_MATH:
3275 str = _("Allow TeXMacs shorthand, like => converting to \\Rightarrow.");
3278 case RC_NUMLASTFILES:
3279 str = bformat(_("Maximal number of lastfiles. Up to %1$d can appear in the file menu."),
3283 case RC_PATH_PREFIX:
3284 str = _("Specify those directories which should be "
3285 "prepended to the PATH environment variable.\n"
3286 "Use the OS native format.");
3290 str = _("Shows a typeset preview of things such as math");
3293 case RC_PREVIEW_HASHED_LABELS:
3294 str = _("Previewed equations will have \"(#)\" labels rather than numbered ones");
3297 case RC_PREVIEW_SCALE_FACTOR:
3298 str = _("Scale the preview size to suit.");
3301 case RC_PRINTLANDSCAPEFLAG:
3302 str = _("The option to print out in landscape.");
3305 case RC_PRINTPAPERDIMENSIONFLAG:
3306 str = _("Option to specify the dimensions of the print paper.");
3309 case RC_PRINTPAPERFLAG:
3310 str = _("The option to specify paper type.");
3313 case RC_VISUAL_CURSOR:
3314 str = _("Select to have visual bidi cursor movement, unselect for logical movement.");
3317 case RC_CLOSE_BUFFER_WITH_LAST_VIEW:
3318 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).");
3322 str = _("DPI (dots per inch) of your monitor is auto-detected by LyX. If that goes wrong, override the setting here.");
3325 case RC_SCREEN_FONT_ROMAN:
3326 case RC_SCREEN_FONT_SANS:
3327 case RC_SCREEN_FONT_TYPEWRITER:
3328 str = _("The screen fonts used to display the text while editing.");
3331 case RC_SCREEN_FONT_ROMAN_FOUNDRY:
3332 case RC_SCREEN_FONT_SANS_FOUNDRY:
3333 case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
3336 case RC_SCREEN_FONT_SCALABLE:
3337 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.");
3340 case RC_SCREEN_FONT_SIZES:
3341 str = _("The font sizes used for calculating the scaling of the screen fonts.");
3344 case RC_SCREEN_ZOOM:
3345 //xgettext:no-c-format
3346 str = _("The zoom percentage for screen fonts. A setting of 100% will make the fonts roughly the same size as on paper.");
3349 case RC_GEOMETRY_SESSION:
3350 str = _("Allow session manager to save and restore windows geometry.");
3354 str = _("This starts the lyxserver. The pipes get an additional extension \".in\" and \".out\". Only for advanced users.");
3360 case RC_SHOW_BANNER:
3361 str = _("De-select if you don't want the startup banner.");
3364 case RC_TEMPDIRPATH:
3365 str = _("LyX will place its temporary directories in this path. They will be deleted when you quit LyX.");
3368 case RC_THESAURUSDIRPATH:
3369 str = _("This is the place where the files of the thesaurus library reside.");
3372 case RC_TEMPLATEPATH:
3373 str = _("The path that LyX will set when offering to choose a template. An empty value selects the directory LyX was started from.");
3376 case RC_TEX_ALLOWS_SPACES:
3379 case RC_TEX_EXPECTS_WINDOWS_PATHS:
3382 case RC_TEXINPUTS_PREFIX:
3383 str = _("Specify those directories which should be "
3384 "prepended to the TEXINPUTS environment variable.\n"
3385 "A '.' represents the current document directory. "
3386 "Use the OS native format.");
3390 str = _("The UI (user interface) file. Can either specify an absolute path, or LyX will look in its global and local ui/ directories.");
3399 case RC_USE_USE_SYSTEM_COLORS:
3400 str = _("Enable use the system colors for some things like main window background and selection.");
3403 case RC_USE_TOOLTIP:
3404 str = _("Enable the automatic appearance of tool tips in the work area.");
3407 case RC_VIEWDVI_PAPEROPTION:
3408 _("Specify the paper command to DVI viewer (leave empty or use \"-paper\")");
3423 // The global instance
3426 // The global copy of the system lyxrc entries (everything except preferences)