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 { "\\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_limit", LyXRC::RC_FULL_SCREEN_LIMIT },
120 { "\\fullscreen_menubar", LyXRC::RC_FULL_SCREEN_MENUBAR },
121 { "\\fullscreen_scrollbar", LyXRC::RC_FULL_SCREEN_SCROLLBAR },
122 { "\\fullscreen_statusbar", LyXRC::RC_FULL_SCREEN_STATUSBAR },
123 { "\\fullscreen_tabbar", LyXRC::RC_FULL_SCREEN_TABBAR },
124 { "\\fullscreen_toolbars", LyXRC::RC_FULL_SCREEN_TOOLBARS },
125 { "\\fullscreen_width", LyXRC::RC_FULL_SCREEN_WIDTH },
126 { "\\group_layouts", LyXRC::RC_GROUP_LAYOUTS },
127 { "\\gui_language", LyXRC::RC_GUI_LANGUAGE },
128 { "\\hunspelldir_path", LyXRC::RC_HUNSPELLDIR_PATH },
129 { "\\icon_set", LyXRC::RC_ICON_SET },
130 { "\\index_alternatives", LyXRC::RC_INDEX_ALTERNATIVES },
131 { "\\index_command", LyXRC::RC_INDEX_COMMAND },
132 { "\\input", LyXRC::RC_INPUT },
133 { "\\jbibtex_alternatives", LyXRC::RC_JBIBTEX_ALTERNATIVES },
134 { "\\jbibtex_command", LyXRC::RC_JBIBTEX_COMMAND },
135 { "\\jindex_command", LyXRC::RC_JINDEX_COMMAND },
136 { "\\kbmap", LyXRC::RC_KBMAP },
137 { "\\kbmap_primary", LyXRC::RC_KBMAP_PRIMARY },
138 { "\\kbmap_secondary", LyXRC::RC_KBMAP_SECONDARY },
139 { "\\language_auto_begin", LyXRC::RC_LANGUAGE_AUTO_BEGIN },
140 { "\\language_auto_end", LyXRC::RC_LANGUAGE_AUTO_END },
141 { "\\language_command_begin", LyXRC::RC_LANGUAGE_COMMAND_BEGIN },
142 { "\\language_command_end", LyXRC::RC_LANGUAGE_COMMAND_END },
143 { "\\language_command_local", LyXRC::RC_LANGUAGE_COMMAND_LOCAL },
144 { "\\language_custom_package", LyXRC::RC_LANGUAGE_CUSTOM_PACKAGE },
145 { "\\language_global_options", LyXRC::RC_LANGUAGE_GLOBAL_OPTIONS },
146 { "\\language_package_selection", LyXRC::RC_LANGUAGE_PACKAGE_SELECTION },
147 { "\\load_session", LyXRC::RC_LOADSESSION },
148 { "\\mac_dontswap_ctrl_meta", LyXRC::RC_MAC_DONTSWAP_CTRL_META },
149 { "\\mac_like_cursor_movement", LyXRC::RC_MAC_LIKE_CURSOR_MOVEMENT },
150 { "\\macro_edit_style", LyXRC::RC_MACRO_EDIT_STYLE },
151 { "\\make_backup", LyXRC::RC_MAKE_BACKUP },
152 { "\\mark_foreign_language", LyXRC::RC_MARK_FOREIGN_LANGUAGE },
153 { "\\mouse_middlebutton_paste", LyXRC::RC_MOUSE_MIDDLEBUTTON_PASTE },
154 { "\\mouse_wheel_speed", LyXRC::RC_MOUSE_WHEEL_SPEED },
155 { "\\nomencl_command", LyXRC::RC_NOMENCL_COMMAND },
156 { "\\num_lastfiles", LyXRC::RC_NUMLASTFILES },
157 { "\\open_buffers_in_tabs", LyXRC::RC_OPEN_BUFFERS_IN_TABS },
158 { "\\paragraph_markers", LyXRC::RC_PARAGRAPH_MARKERS },
159 { "\\path_prefix", LyXRC::RC_PATH_PREFIX },
160 { "\\plaintext_linelen", LyXRC::RC_PLAINTEXT_LINELEN },
161 { "\\preview", LyXRC::RC_PREVIEW },
162 { "\\preview_hashed_labels", LyXRC::RC_PREVIEW_HASHED_LABELS },
163 { "\\preview_scale_factor", LyXRC::RC_PREVIEW_SCALE_FACTOR },
164 { "\\print_landscape_flag", LyXRC::RC_PRINTLANDSCAPEFLAG },
165 { "\\print_paper_dimension_flag", LyXRC::RC_PRINTPAPERDIMENSIONFLAG },
166 { "\\print_paper_flag", LyXRC::RC_PRINTPAPERFLAG },
167 { "\\pygmentize_command", LyXRC::RC_PYGMENTIZE_COMMAND },
168 { "\\respect_os_kbd_language", LyXRC::RC_RESPECT_OS_KBD_LANGUAGE },
169 { "\\save_compressed", LyXRC::RC_SAVE_COMPRESSED },
170 { "\\save_origin", LyXRC::RC_SAVE_ORIGIN },
171 { "\\screen_dpi", LyXRC::RC_SCREEN_DPI },
172 { "\\screen_font_roman", LyXRC::RC_SCREEN_FONT_ROMAN },
173 { "\\screen_font_roman_foundry", LyXRC::RC_SCREEN_FONT_ROMAN_FOUNDRY },
174 { "\\screen_font_sans", LyXRC::RC_SCREEN_FONT_SANS },
175 { "\\screen_font_sans_foundry", LyXRC::RC_SCREEN_FONT_SANS_FOUNDRY },
176 { "\\screen_font_scalable", LyXRC::RC_SCREEN_FONT_SCALABLE },
177 { "\\screen_font_sizes", LyXRC::RC_SCREEN_FONT_SIZES },
178 { "\\screen_font_typewriter", LyXRC::RC_SCREEN_FONT_TYPEWRITER },
179 { "\\screen_font_typewriter_foundry", LyXRC::RC_SCREEN_FONT_TYPEWRITER_FOUNDRY },
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 { "\\use_converter_cache", LyXRC::RC_USE_CONVERTER_CACHE },
201 { "\\use_converter_needauth", LyXRC::RC_USE_CONVERTER_NEEDAUTH },
202 { "\\use_converter_needauth_forbidden", LyXRC::RC_USE_CONVERTER_NEEDAUTH_FORBIDDEN },
203 { "\\use_lastfilepos", LyXRC::RC_USELASTFILEPOS },
204 { "\\use_native_filedialog", LyXRC::RC_USE_NATIVE_FILEDIALOG },
205 // compatibility with versions older than 1.4.0 only
206 { "\\use_system_colors", LyXRC::RC_USE_SYSTEM_COLORS },
207 { "\\use_system_theme_icons", LyXRC::RC_USE_SYSTEM_THEME_ICONS },
208 { "\\use_tooltip", LyXRC::RC_USE_TOOLTIP },
209 { "\\user_email", LyXRC::RC_USER_EMAIL },
210 { "\\user_initials", LyXRC::RC_USER_INITIALS },
211 { "\\user_name", LyXRC::RC_USER_NAME },
212 { "\\view_dvi_paper_option", LyXRC::RC_VIEWDVI_PAPEROPTION },
213 // compatibility with versions older than 1.4.0 only
214 { "\\viewer", LyXRC::RC_VIEWER},
215 { "\\viewer_alternatives", LyXRC::RC_VIEWER_ALTERNATIVES },
216 { "\\visual_cursor", LyXRC::RC_VISUAL_CURSOR },
217 { "format", LyXRC::RC_LYXRCFORMAT }
220 const int lyxrcCount = sizeof(lyxrcTags) / sizeof(lyxrcTags[0]);
223 void oldFontFormat(string & family, string & foundry)
225 if (family.empty() || family[0] != '-')
227 foundry = token(family, '-', 1);
228 family = token(family, '-', 2);
236 bool LyXRC::read(FileName const & filename, bool check_format)
238 Lexer lexrc(lyxrcTags);
239 lexrc.setFile(filename);
240 LYXERR(Debug::LYXRC, "Reading '" << filename << "'...");
241 ReturnValues retval = read(lexrc, check_format);
242 if (!check_format || retval != FormatMismatch)
243 return retval == ReadOK;
245 LYXERR(Debug::FILES, "Converting LyXRC file to " << LYXRC_FILEFORMAT);
246 TempFile tmp("convert_lyxrc");
247 FileName const tempfile = tmp.name();
248 bool const success = prefs2prefs(filename, tempfile, false);
250 LYXERR0 ("Unable to convert " << filename.absFileName() <<
251 " to format " << LYXRC_FILEFORMAT);
254 // Keep this in the else branch, such that lexrc2 goes out
255 // of scope and releases the lock on tempfile before we
256 // attempt to remove it. This matters on Windows.
257 Lexer lexrc2(lyxrcTags);
258 lexrc2.setFile(tempfile);
259 LYXERR(Debug::LYXRC, "Reading '" << tempfile << "'...");
260 retval = read(lexrc2, check_format);
261 if (retval == FormatMismatch)
262 LYXERR0("Conversion failed for " << filename.absFileName());
264 return retval == ReadOK;
268 // don't need to worry about conversion, because this is always
269 // from an internal source
270 bool LyXRC::read(istream & is)
272 Lexer lexrc(lyxrcTags);
274 LYXERR(Debug::LYXRC, "Reading istream...");
275 return read(lexrc, false) == ReadOK;
279 LyXRC::ReturnValues LyXRC::read(Lexer & lexrc, bool check_format)
281 if (lyxerr.debugging(Debug::PARSER))
282 lexrc.printTable(lyxerr);
287 // format prior to 2.0 and introduction of format tag
288 unsigned int rc_format = 0;
290 while (lexrc.isOK()) {
291 // By using two switches we take advantage of the compiler
292 // telling us if we have missed a LyXRCTags element in
293 // the second switch.
294 // Note that this also shows a problem with Lexer since it
295 // helps us avoid taking advantage of the strictness of the
298 int le = lexrc.lex();
300 case Lexer::LEX_UNDEF:
301 lexrc.printError("Unknown tag `$$Token'");
303 case Lexer::LEX_FEOF:
308 switch (static_cast<LyXRCTags>(le)) {
311 rc_format = lexrc.getInteger();
313 case RC_INPUT: // Include file
316 libFileSearch(string(),
318 if (!read(tmp, check_format)) {
320 "Error reading included file: " + tmp.absFileName());
326 bind_file = os::internal_path(lexrc.getString());
331 def_file = os::internal_path(lexrc.getString());
336 ui_file = os::internal_path(lexrc.getString());
339 case RC_AUTORESET_OPTIONS:
340 lexrc >> auto_reset_options;
343 case RC_DISPLAY_GRAPHICS:
345 display_graphics = lexrc.getString() == "true";
348 case RC_TEX_EXPECTS_WINDOWS_PATHS:
349 lexrc >> windows_style_tex_paths;
352 case RC_TEX_ALLOWS_SPACES:
353 lexrc >> tex_allows_spaces;
356 case RC_TEXINPUTS_PREFIX:
357 lexrc >> texinputs_prefix;
364 case RC_KBMAP_PRIMARY:
366 string const kmap(os::internal_path(lexrc.getString()));
367 if (!libFileSearch("kbd", kmap, "kmap").empty()
369 primary_kbmap = kmap;
371 lexrc.printError("LyX: Keymap `$$Token' not found");
376 case RC_KBMAP_SECONDARY:
378 string const kmap(os::internal_path(lexrc.getString()));
379 if (!libFileSearch("kbd", kmap, "kmap").empty()
381 secondary_kbmap = kmap;
383 lexrc.printError("LyX: Keymap `$$Token' not found");
388 case RC_PRINTLANDSCAPEFLAG:
389 lexrc >> print_landscape_flag;
392 case RC_PRINTPAPERDIMENSIONFLAG:
393 lexrc >> print_paper_dimension_flag;
396 case RC_PRINTPAPERFLAG:
397 lexrc >> print_paper_flag;
400 case RC_PYGMENTIZE_COMMAND:
401 if (lexrc.next(true)) {
402 pygmentize_command = lexrc.getString();
406 case RC_VIEWDVI_PAPEROPTION:
408 view_dvi_paper_option = lexrc.getString();
410 view_dvi_paper_option.erase();
413 case RC_CHKTEX_COMMAND:
414 if (lexrc.next(true)) {
415 chktex_command = lexrc.getString();
419 case RC_BIBTEX_ALTERNATIVES:
420 if (lexrc.next(true)) {
421 bibtex_alternatives.insert(lexrc.getString());
425 case RC_BIBTEX_COMMAND:
426 if (lexrc.next(true)) {
427 bibtex_command = lexrc.getString();
431 case RC_JBIBTEX_COMMAND:
432 if (lexrc.next(true)) {
433 jbibtex_command = lexrc.getString();
437 case RC_JBIBTEX_ALTERNATIVES:
438 if (lexrc.next(true)) {
439 jbibtex_alternatives.insert(lexrc.getString());
443 case RC_INDEX_ALTERNATIVES:
444 if (lexrc.next(true)) {
445 index_alternatives.insert(lexrc.getString());
449 case RC_INDEX_COMMAND:
450 if (lexrc.next(true)) {
451 index_command = lexrc.getString();
455 case RC_JINDEX_COMMAND:
456 if (lexrc.next(true)) {
457 jindex_command = lexrc.getString();
461 case RC_SPLITINDEX_COMMAND:
462 if (lexrc.next(true)) {
463 splitindex_command = lexrc.getString();
467 case RC_NOMENCL_COMMAND:
468 if (lexrc.next(true)) {
469 nomencl_command = lexrc.getString();
478 lexrc >> defaultZoom;
479 if (defaultZoom < 10)
483 case RC_GEOMETRY_SESSION:
484 lexrc >> allow_geometry_session;
487 case RC_SCREEN_FONT_SIZES:
488 lexrc >> font_sizes[TINY_SIZE];
489 lexrc >> font_sizes[SCRIPT_SIZE];
490 lexrc >> font_sizes[FOOTNOTE_SIZE];
491 lexrc >> font_sizes[SMALL_SIZE];
492 lexrc >> font_sizes[NORMAL_SIZE];
493 lexrc >> font_sizes[LARGE_SIZE];
494 lexrc >> font_sizes[LARGER_SIZE];
495 lexrc >> font_sizes[LARGEST_SIZE];
496 lexrc >> font_sizes[HUGE_SIZE];
497 lexrc >> font_sizes[HUGER_SIZE];
500 case RC_SCREEN_FONT_SCALABLE:
501 lexrc >> use_scalable_fonts;
508 case RC_DOCUMENTPATH:
510 document_path = os::internal_path(lexrc.getString());
515 example_path = os::internal_path(lexrc.getString());
518 case RC_TEMPLATEPATH:
520 template_path = os::internal_path(lexrc.getString());
525 tempdir_path = os::internal_path(lexrc.getString());
528 case RC_THESAURUSDIRPATH:
530 thesaurusdir_path = os::internal_path(lexrc.getString());
533 case RC_HUNSPELLDIR_PATH:
535 hunspelldir_path = os::internal_path(lexrc.getString());
538 case RC_USELASTFILEPOS:
539 lexrc >> use_lastfilepos;
543 lexrc >> load_session;
546 case RC_MOUSE_WHEEL_SPEED:
547 lexrc >> mouse_wheel_speed;
550 case RC_COMPLETION_INLINE_DELAY:
551 lexrc >> completion_inline_delay;
554 case RC_COMPLETION_INLINE_MATH:
555 lexrc >> completion_inline_math;
558 case RC_COMPLETION_INLINE_TEXT:
559 lexrc >> completion_inline_text;
562 case RC_COMPLETION_INLINE_DOTS:
563 lexrc >> completion_inline_dots;
566 case RC_AUTOCORRECTION_MATH:
567 lexrc >> autocorrection_math;
570 case RC_COMPLETION_POPUP_DELAY:
571 lexrc >> completion_popup_delay;
574 case RC_COMPLETION_POPUP_MATH:
575 lexrc >> completion_popup_math;
578 case RC_COMPLETION_POPUP_TEXT:
579 lexrc >> completion_popup_text;
582 case RC_COMPLETION_CURSOR_TEXT:
583 lexrc >> completion_cursor_text;
586 case RC_COMPLETION_POPUP_AFTER_COMPLETE:
587 lexrc >> completion_popup_after_complete;
590 case RC_COMPLETION_MINLENGTH:
591 lexrc >> completion_minlength;
594 case RC_NUMLASTFILES:
595 lexrc >> num_lastfiles;
598 case RC_CHECKLASTFILES:
599 lexrc >> check_lastfiles;
606 case RC_USE_SYSTEM_THEME_ICONS:
607 lexrc >> use_system_theme_icons;
610 case RC_SCREEN_FONT_ROMAN:
612 roman_font_name = lexrc.getString();
613 oldFontFormat(roman_font_name,
618 case RC_SCREEN_FONT_SANS:
620 sans_font_name = lexrc.getString();
621 oldFontFormat(sans_font_name, sans_font_foundry);
625 case RC_SCREEN_FONT_TYPEWRITER:
627 typewriter_font_name = lexrc.getString();
628 oldFontFormat(typewriter_font_name,
629 typewriter_font_foundry);
633 case RC_SCREEN_FONT_ROMAN_FOUNDRY:
634 lexrc >> roman_font_foundry;
637 case RC_SCREEN_FONT_SANS_FOUNDRY:
638 lexrc >> sans_font_foundry;
641 case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
642 lexrc >> typewriter_font_foundry;
647 lexrc.printError("Missing color tag.");
650 string const lyx_name = lexrc.getString();
653 lexrc.printError("Missing color name for color: `$$Token'");
656 string const x11_name = lexrc.getString();
658 string x11_darkname = x11_name;
660 x11_darkname = lexrc.getString();
662 ColorCode const col =
663 lcolor.getFromLyXName(lyx_name);
664 if (col == Color_none ||
665 col == Color_inherit ||
669 if (!lcolor.setColor(col, x11_name, x11_darkname))
670 LYXERR0("Bad lyxrc set_color for " << lyx_name);
671 LYXERR(Debug::LYXRC, "Set " << lyx_name << "(" << col << ") to "
672 << x11_name << " and " << x11_darkname);
676 case RC_AUTOREGIONDELETE:
677 // Auto region delete defaults to true
678 lexrc >> auto_region_delete;
683 string userdir = package().user_support().absFileName();
684 if (userdir.back() == '/')
686 lyxpipes = subst(os::internal_path(lexrc.getString()), "$$UserDir",
691 case RC_CITATION_SEARCH:
692 lexrc >> citation_search;
695 case RC_CITATION_SEARCH_PATTERN:
697 citation_search_pattern = lexrc.getString();
700 case RC_CITATION_SEARCH_VIEW:
702 citation_search_view = lexrc.getString();
705 case RC_CT_ADDITIONS_UNDERLINED:
706 lexrc >> ct_additions_underlined;
709 case RC_CT_MARKUP_COPIED:
710 lexrc >> ct_markup_copied;
713 case RC_CURSOR_FOLLOWS_SCROLLBAR:
714 lexrc >> cursor_follows_scrollbar;
717 case RC_CURSOR_WIDTH:
718 lexrc >> cursor_width;
721 case RC_SCROLL_BELOW_DOCUMENT:
722 lexrc >> scroll_below_document;
725 case RC_PARAGRAPH_MARKERS:
726 lexrc >> paragraph_markers;
729 case RC_MAC_DONTSWAP_CTRL_META:
730 lexrc >> mac_dontswap_ctrl_meta;
733 case RC_MAC_LIKE_CURSOR_MOVEMENT:
734 lexrc >> mac_like_cursor_movement;
737 case RC_MACRO_EDIT_STYLE:
739 switch (lexrc.getInteger()) {
740 case 0: macro_edit_style = MACRO_EDIT_INLINE_BOX; break;
741 case 1: macro_edit_style = MACRO_EDIT_INLINE; break;
742 case 2: macro_edit_style = MACRO_EDIT_LIST; break;
747 case RC_DIALOGS_ICONIFY_WITH_MAIN:
748 lexrc >> dialogs_iconify_with_main;
751 case RC_PLAINTEXT_LINELEN:
752 lexrc >> plaintext_linelen;
754 // Spellchecker settings:
755 case RC_ACCEPT_COMPOUND:
756 lexrc >> spellchecker_accept_compound;
758 case RC_USE_NATIVE_FILEDIALOG:
759 lexrc >> use_native_filedialog;
761 case RC_USE_SYSTEM_COLORS:
762 lexrc >> use_system_colors;
765 lexrc >> use_tooltip;
767 case RC_SPELLCHECKER:
768 lexrc >> spellchecker;
771 lexrc >> spellchecker_alt_lang;
774 lexrc >> spellchecker_esc_chars;
776 case RC_SPELLCHECK_CONTINUOUSLY:
777 lexrc >> spellcheck_continuously;
779 case RC_SPELLCHECK_NOTES:
780 lexrc >> spellcheck_notes;
783 lexrc >> make_backup;
785 case RC_SAVE_COMPRESSED:
786 lexrc >> save_compressed;
789 lexrc >> save_origin;
791 case RC_BACKUPDIR_PATH:
793 backupdir_path = os::internal_path(lexrc.getString());
795 case RC_DEFAULT_DECIMAL_SEP:
796 lexrc >> default_decimal_sep;
798 case RC_DEFAULT_LENGTH_UNIT:
800 default_length_unit = (Length::UNIT) lexrc.getInteger();
802 case RC_LANGUAGE_CUSTOM_PACKAGE:
803 lexrc >> language_custom_package;
805 case RC_LANGUAGE_AUTO_BEGIN:
806 lexrc >> language_auto_begin;
808 case RC_LANGUAGE_AUTO_END:
809 lexrc >> language_auto_end;
811 case RC_LANGUAGE_GLOBAL_OPTIONS:
812 lexrc >> language_global_options;
814 case RC_LANGUAGE_PACKAGE_SELECTION:
816 switch (lexrc.getInteger()) {
818 language_package_selection = LP_AUTO;
821 language_package_selection = LP_BABEL;
824 language_package_selection = LP_CUSTOM;
827 language_package_selection = LP_NONE;
832 case RC_LANGUAGE_COMMAND_BEGIN:
833 lexrc >> language_command_begin;
835 case RC_LANGUAGE_COMMAND_END:
836 lexrc >> language_command_end;
838 case RC_LANGUAGE_COMMAND_LOCAL:
839 lexrc >> language_command_local;
841 case RC_RESPECT_OS_KBD_LANGUAGE:
842 lexrc >> respect_os_kbd_language;
844 case RC_VISUAL_CURSOR:
845 lexrc >> visual_cursor;
847 case RC_CLOSE_BUFFER_WITH_LAST_VIEW:
848 lexrc >> close_buffer_with_last_view;
851 lexrc >> auto_number;
853 case RC_MARK_FOREIGN_LANGUAGE:
854 lexrc >> mark_foreign_language;
860 fmt = lexrc.getString();
861 if (lexrc.next(true))
862 command = lexrc.getString();
863 setMover(fmt, command);
868 string from, to, command, flags;
870 from = lexrc.getString();
872 to = lexrc.getString();
873 if (lexrc.next(true))
874 command = lexrc.getString();
876 flags = lexrc.getString();
878 theConverters().erase(from, to);
880 theConverters().add(from, to, command, flags);
883 // compatibility with versions older than 1.4.0 only
885 string format, command;
886 lexrc >> format >> command;
887 theFormats().setViewer(format, command);
890 case RC_FILEFORMAT: {
892 string format, extensions, shortcut;
893 docstring prettyname;
894 if (!(lexrc >> format >> extensions))
896 if (ok && lexrc.next(true))
897 prettyname = lexrc.getDocString();
901 if(!(lexrc >> shortcut))
903 string viewer, editor;
904 if (ok && lexrc.next(true))
905 viewer = lexrc.getString();
908 if (ok && lexrc.next(true))
909 editor = lexrc.getString();
913 if (!(lexrc >> flags >> mime))
915 int flgs = Format::none;
916 while (!flags.empty()) {
918 flags = split(flags, flag, ',');
919 if (flag == "document")
920 flgs |= Format::document;
921 else if (flag == "vector")
922 flgs |= Format::vector;
923 else if (flag == "zipped=native")
924 flgs |= Format::zipped_native;
925 else if (flag == "menu=export")
926 flgs |= Format::export_menu;
927 else if (flag == "menu=none")
928 flgs |= Format::no_menu;
930 LYXERR0("Ignoring unknown flag `"
931 << flag << "' for format `"
935 LYXERR0("Syntax error in format " << format);
936 else if (prettyname.empty()) {
937 if (theConverters().formatIsUsed(format))
938 LYXERR0("Can't delete format " << format);
940 theFormats().erase(format);
942 theFormats().add(format, extensions, prettyname,
943 shortcut, viewer, editor, mime, flgs);
947 case RC_VIEWER_ALTERNATIVES: {
948 string format, command;
949 if ((lexrc >> format) && lexrc.next(true)) {
950 command = lexrc.getString();
951 viewer_alternatives[format].insert(command);
955 case RC_EDITOR_ALTERNATIVES: {
956 string format, command;
957 if ((lexrc >> format) && lexrc.next(true)) {
958 command = lexrc.getString();
959 editor_alternatives[format].insert(command);
964 case RC_DEFAULT_OTF_VIEW_FORMAT:
965 lexrc >> default_otf_view_format;
968 case RC_DEFAULT_PLATEX_VIEW_FORMAT:
969 lexrc >> default_platex_view_format;
972 case RC_DEFAULT_VIEW_FORMAT:
973 lexrc >> default_view_format;
976 case RC_GUI_LANGUAGE:
977 lexrc >> gui_language;
981 lexrc >> show_banner;
986 string const tmp = lexrc.getString();
987 if (tmp == "true" || tmp == "on")
988 preview = PREVIEW_ON;
989 else if (tmp == "no_math")
990 preview = PREVIEW_NO_MATH;
992 preview = PREVIEW_OFF;
993 if (tmp != "false" && tmp != "off")
994 LYXERR0("Unrecognized preview status \""
1000 case RC_PREVIEW_HASHED_LABELS:
1001 lexrc >> preview_hashed_labels;
1004 case RC_PREVIEW_SCALE_FACTOR:
1005 lexrc >> preview_scale_factor;
1012 lexrc >> user_email;
1014 case RC_USER_INITIALS:
1015 lexrc >> user_initials;
1018 case RC_PATH_PREFIX:
1019 lexrc >> path_prefix;
1022 case RC_USE_CONVERTER_CACHE:
1023 lexrc >> use_converter_cache;
1025 case RC_USE_CONVERTER_NEEDAUTH_FORBIDDEN:
1026 lexrc >> use_converter_needauth_forbidden;
1028 case RC_USE_CONVERTER_NEEDAUTH:
1029 lexrc >> use_converter_needauth;
1031 case RC_CONVERTER_CACHE_MAXAGE:
1032 lexrc >> converter_cache_maxage;
1035 case RC_SORT_LAYOUTS:
1036 lexrc >> sort_layouts;
1038 case RC_GROUP_LAYOUTS:
1039 lexrc >> group_layouts;
1041 case RC_FULL_SCREEN_LIMIT:
1042 lexrc >> full_screen_limit;
1044 case RC_FULL_SCREEN_TOOLBARS:
1045 lexrc >> full_screen_toolbars;
1047 case RC_FULL_SCREEN_SCROLLBAR:
1048 lexrc >> full_screen_scrollbar;
1050 case RC_FULL_SCREEN_STATUSBAR:
1051 lexrc >> full_screen_statusbar;
1053 case RC_FULL_SCREEN_TABBAR:
1054 lexrc >> full_screen_tabbar;
1056 case RC_FULL_SCREEN_MENUBAR:
1057 lexrc >> full_screen_menubar;
1059 case RC_FULL_SCREEN_WIDTH:
1060 lexrc >> full_screen_width;
1062 case RC_OPEN_BUFFERS_IN_TABS:
1063 lexrc >> open_buffers_in_tabs;
1064 #ifdef USE_MACOSX_PACKAGING
1065 if (appleUserTabbingPreferenceAlways())
1066 open_buffers_in_tabs = true;
1069 case RC_SINGLE_CLOSE_TAB_BUTTON:
1070 lexrc >> single_close_tab_button;
1072 case RC_SINGLE_INSTANCE:
1073 lexrc >> single_instance;
1074 if (run_mode == PREFERRED)
1075 run_mode = single_instance ? USE_REMOTE : NEW_INSTANCE;
1077 case RC_FORWARD_SEARCH_DVI:
1078 if (lexrc.next(true))
1079 forward_search_dvi = lexrc.getString();
1081 case RC_FORWARD_SEARCH_PDF:
1082 if (lexrc.next(true))
1083 forward_search_pdf = lexrc.getString();
1085 case RC_EXPORT_OVERWRITE:
1087 string const tmp = lexrc.getString();
1088 if (tmp == "all" || tmp == "true")
1089 export_overwrite = ALL_FILES;
1090 else if (tmp == "main")
1091 export_overwrite = MAIN_FILE;
1093 export_overwrite = NO_FILES;
1094 if (tmp != "ask" && tmp != "false")
1095 LYXERR0("Unrecognized export_overwrite status \""
1100 case RC_SCROLL_WHEEL_ZOOM:
1102 string const tmp = lexrc.getString();
1104 scroll_wheel_zoom = SCROLL_WHEEL_ZOOM_CTRL;
1105 else if (tmp == "shift")
1106 scroll_wheel_zoom = SCROLL_WHEEL_ZOOM_SHIFT;
1107 else if (tmp == "alt")
1108 scroll_wheel_zoom = SCROLL_WHEEL_ZOOM_ALT;
1110 scroll_wheel_zoom = SCROLL_WHEEL_ZOOM_OFF;
1111 if (tmp != "off" && tmp != "false")
1112 LYXERR0("Unrecognized scroll_wheel_zoom status \""
1118 case RC_MOUSE_MIDDLEBUTTON_PASTE:
1119 lexrc >> mouse_middlebutton_paste;
1122 case RC_BOOKMARKS_VISIBILITY:
1124 string const tmp = lexrc.getString();
1126 bookmarks_visibility = BMK_NONE;
1127 else if (tmp == "margin")
1128 bookmarks_visibility = BMK_MARGIN;
1129 else if (tmp == "inline")
1130 bookmarks_visibility = BMK_INLINE;
1132 bookmarks_visibility = BMK_NONE;
1133 LYXERR0("Unrecognized bookmark visibility " << tmp <<'"');
1138 case RC_DRAW_STRATEGY:
1140 string const tmp = lexrc.getString();
1141 if (tmp == "partial")
1142 draw_strategy = DS_PARTIAL;
1143 else if (tmp == "backingstore")
1144 draw_strategy = DS_BACKINGSTORE;
1146 draw_strategy = DS_PARTIAL;
1147 LYXERR0("Unrecognized draw strategy " << tmp <<'"');
1153 break; // this is just a dummy
1156 // This is triggered the first time through the loop unless
1157 // we hit a format tag.
1158 if (check_format && rc_format != LYXRC_FILEFORMAT)
1159 return FormatMismatch;
1162 /// Update converters data-structures
1163 theConverters().update(theFormats());
1164 theConverters().buildGraph();
1165 theBufferList().invalidateConverterCache();
1171 void LyXRC::write(FileName const & filename, bool ignore_system_lyxrc) const
1173 ofstream ofs(filename.toFilesystemEncoding().c_str());
1175 write(ofs, ignore_system_lyxrc);
1179 void LyXRC::print() const
1181 if (lyxerr.debugging())
1182 write(lyxerr, false);
1190 typedef pair<string, SpecialisedMover> Data;
1192 SameMover(Data const & comparison)
1193 : comparison_(comparison) {}
1195 bool operator()(Data const & data) const
1197 return data.first == comparison_.first &&
1198 data.second.command() == comparison_.second.command();
1208 // Escape \ and " so that LyXLex can read the string later
1209 string escapeCommand(string const & str) {
1210 return subst(subst(str , "\\", "\\\\"),
1217 void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) const
1219 LyXRCTags tag = RC_LAST;
1221 if (!name.empty()) {
1222 for (int i = 0; i != lyxrcCount; ++i)
1223 if ("\\" + name == lyxrcTags[i].tag)
1224 tag = static_cast<LyXRCTags>(lyxrcTags[i].code);
1228 os << "# LyX " << lyx_version
1229 << " generated this file. If you want to make your own\n"
1230 << "# modifications you should do them from inside LyX and save.\n\n"
1231 << "Format " << LYXRC_FILEFORMAT << "\n\n";
1233 // Why the switch you might ask. It is a trick to ensure that all
1234 // the elements in the LyXRCTags enum are handled. As you can see
1235 // there are no breaks at all. So it is just a huge fall-through.
1236 // The nice thing is that we will get a warning from the compiler
1237 // if we forget an element.
1241 // input/include files are not done here
1242 case RC_LYXRCFORMAT:
1244 if (ignore_system_lyxrc ||
1245 bind_file != system_lyxrc.bind_file) {
1246 string const path = os::external_path(bind_file);
1247 os << "\\bind_file \"" << path << "\"\n";
1253 if (ignore_system_lyxrc ||
1254 def_file != system_lyxrc.def_file) {
1255 string const path = os::external_path(def_file);
1256 os << "\\def_file \"" << path << "\"\n";
1265 << "# MISC SECTION ######################################\n"
1267 // bind files are not done here.
1269 case RC_PATH_PREFIX:
1270 if (ignore_system_lyxrc ||
1271 path_prefix != system_lyxrc.path_prefix) {
1272 os << "\\path_prefix \"" << path_prefix << "\"\n";
1278 if (ignore_system_lyxrc ||
1279 ui_file != system_lyxrc.ui_file) {
1280 string const path = os::external_path(ui_file);
1281 os << "\\ui_file \"" << path << "\"\n";
1286 case RC_AUTOREGIONDELETE:
1287 if (ignore_system_lyxrc ||
1288 auto_region_delete != system_lyxrc.auto_region_delete) {
1289 os << "# Set to false to inhibit automatic replacement of\n"
1290 << "# the current selection.\n"
1291 << "\\auto_region_delete " << convert<string>(auto_region_delete)
1297 case RC_AUTORESET_OPTIONS:
1298 if (ignore_system_lyxrc ||
1299 auto_reset_options != system_lyxrc.auto_reset_options) {
1300 os << "# Set to false to inhibit automatic reset of\n"
1301 << "# the class options to defaults on class change.\n"
1302 << "\\auto_reset_options "
1303 << convert<string>(auto_reset_options)
1310 if (ignore_system_lyxrc ||
1311 autosave != system_lyxrc.autosave) {
1312 os << "# The time interval between auto-saves in seconds.\n"
1313 << "\\autosave " << autosave << '\n';
1318 case RC_DISPLAY_GRAPHICS:
1319 if (ignore_system_lyxrc ||
1320 display_graphics != system_lyxrc.display_graphics) {
1321 os << "# Display graphics within LyX\n"
1323 << "\\display_graphics "
1324 << (display_graphics ? "true" : "false")
1330 case RC_SORT_LAYOUTS:
1331 if (ignore_system_lyxrc ||
1332 sort_layouts != system_lyxrc.sort_layouts) {
1333 os << "# Sort layouts alphabetically.\n"
1334 << "\\sort_layouts " << convert<string>(sort_layouts) << '\n';
1339 case RC_GROUP_LAYOUTS:
1340 if (ignore_system_lyxrc ||
1341 group_layouts != system_lyxrc.group_layouts) {
1342 os << "# Group layouts by their category.\n"
1343 << "\\group_layouts " << convert<string>(group_layouts) << '\n';
1348 case RC_VIEWDVI_PAPEROPTION:
1349 if (ignore_system_lyxrc ||
1350 view_dvi_paper_option
1351 != system_lyxrc.view_dvi_paper_option) {
1352 os << "# Options used to specify paper size to the\n"
1353 << "# view_dvi_command (e.g. -paper)\n"
1354 << "\\view_dvi_paper_option \""
1355 << view_dvi_paper_option << "\"\n";
1360 case RC_CHKTEX_COMMAND:
1361 if (ignore_system_lyxrc ||
1362 chktex_command != system_lyxrc.chktex_command) {
1363 os << "\\chktex_command \"" << escapeCommand(chktex_command) << "\"\n";
1368 case RC_BIBTEX_ALTERNATIVES: {
1369 CommandSet::const_iterator it = bibtex_alternatives.begin();
1370 CommandSet::const_iterator end = bibtex_alternatives.end();
1371 for ( ; it != end; ++it) {
1372 if (ignore_system_lyxrc
1373 || !system_lyxrc.bibtex_alternatives.count(*it))
1374 os << "\\bibtex_alternatives \""
1381 case RC_BIBTEX_COMMAND:
1382 if (ignore_system_lyxrc ||
1383 bibtex_command != system_lyxrc.bibtex_command) {
1384 os << "\\bibtex_command \"" << escapeCommand(bibtex_command) << "\"\n";
1389 case RC_JBIBTEX_COMMAND:
1390 if (ignore_system_lyxrc ||
1391 jbibtex_command != system_lyxrc.jbibtex_command) {
1392 os << "\\jbibtex_command \"" << escapeCommand(jbibtex_command) << "\"\n";
1397 case RC_JBIBTEX_ALTERNATIVES: {
1398 CommandSet::const_iterator it = jbibtex_alternatives.begin();
1399 CommandSet::const_iterator end = jbibtex_alternatives.end();
1400 for ( ; it != end; ++it) {
1401 if (ignore_system_lyxrc
1402 || !system_lyxrc.jbibtex_alternatives.count(*it))
1403 os << "\\jbibtex_alternatives \""
1410 case RC_INDEX_ALTERNATIVES: {
1411 CommandSet::const_iterator it = index_alternatives.begin();
1412 CommandSet::const_iterator end = index_alternatives.end();
1413 for ( ; it != end; ++it) {
1414 if (ignore_system_lyxrc
1415 || !system_lyxrc.index_alternatives.count(*it))
1416 os << "\\index_alternatives \""
1423 case RC_INDEX_COMMAND:
1424 if (ignore_system_lyxrc ||
1425 index_command != system_lyxrc.index_command) {
1426 os << "\\index_command \"" << escapeCommand(index_command) << "\"\n";
1431 case RC_JINDEX_COMMAND:
1432 if (ignore_system_lyxrc ||
1433 jindex_command != system_lyxrc.jindex_command) {
1434 os << "\\jindex_command \"" << escapeCommand(jindex_command) << "\"\n";
1439 case RC_SPLITINDEX_COMMAND:
1440 if (ignore_system_lyxrc ||
1441 splitindex_command != system_lyxrc.splitindex_command) {
1442 os << "\\splitindex_command \"" << escapeCommand(splitindex_command) << "\"\n";
1447 case RC_NOMENCL_COMMAND:
1448 if (ignore_system_lyxrc ||
1449 nomencl_command != system_lyxrc.nomencl_command) {
1450 os << "\\nomencl_command \"" << escapeCommand(nomencl_command) << "\"\n";
1455 case RC_PYGMENTIZE_COMMAND:
1456 if (ignore_system_lyxrc ||
1457 pygmentize_command != system_lyxrc.pygmentize_command) {
1458 os << "\\pygmentize_command \"" << escapeCommand(pygmentize_command) << "\"\n";
1463 case RC_TEX_EXPECTS_WINDOWS_PATHS:
1464 // Don't write this setting to the preferences file,
1465 // but allow temporary changes (bug 7557).
1466 if (ignore_system_lyxrc) {
1467 os << "\\tex_expects_windows_paths "
1468 << convert<string>(windows_style_tex_paths) << '\n';
1473 case RC_TEX_ALLOWS_SPACES:
1474 if (tex_allows_spaces != system_lyxrc.tex_allows_spaces) {
1475 os << "\\tex_allows_spaces "
1476 << convert<string>(tex_allows_spaces) << '\n';
1482 if (ignore_system_lyxrc ||
1483 use_kbmap != system_lyxrc.use_kbmap) {
1484 os << "\\kbmap " << convert<string>(use_kbmap) << '\n';
1489 case RC_KBMAP_PRIMARY:
1490 if (ignore_system_lyxrc ||
1491 primary_kbmap != system_lyxrc.primary_kbmap) {
1492 string const path = os::external_path(primary_kbmap);
1493 os << "\\kbmap_primary \"" << path << "\"\n";
1498 case RC_KBMAP_SECONDARY:
1499 if (ignore_system_lyxrc ||
1500 secondary_kbmap != system_lyxrc.secondary_kbmap) {
1501 string const path = os::external_path(secondary_kbmap);
1502 os << "\\kbmap_secondary \"" << path << "\"\n";
1508 if (ignore_system_lyxrc ||
1509 lyxpipes != system_lyxrc.lyxpipes) {
1510 string const path = os::external_path(lyxpipes);
1511 os << "\\serverpipe \"" << path << "\"\n";
1517 os << "\\user_name \"" << user_name << "\"\n";
1522 os << "\\user_email \"" << user_email << "\"\n";
1526 case RC_USER_INITIALS:
1527 os << "\\user_initials \"" << user_initials << "\"\n";
1531 case RC_SHOW_BANNER:
1532 if (ignore_system_lyxrc ||
1533 show_banner != system_lyxrc.show_banner) {
1534 os << "\\show_banner " << convert<string>(show_banner) << '\n';
1540 if (ignore_system_lyxrc ||
1541 preview != system_lyxrc.preview) {
1547 case PREVIEW_NO_MATH:
1554 os << "\\preview " << status << '\n';
1559 case RC_PREVIEW_HASHED_LABELS:
1560 if (ignore_system_lyxrc ||
1561 preview_hashed_labels !=
1562 system_lyxrc.preview_hashed_labels) {
1563 os << "\\preview_hashed_labels "
1564 << convert<string>(preview_hashed_labels) << '\n';
1569 case RC_PREVIEW_SCALE_FACTOR:
1570 if (ignore_system_lyxrc ||
1571 preview_scale_factor != system_lyxrc.preview_scale_factor) {
1572 os << "\\preview_scale_factor "
1573 << preview_scale_factor << '\n';
1578 case RC_USE_CONVERTER_CACHE:
1579 if (ignore_system_lyxrc ||
1580 use_converter_cache != system_lyxrc.use_converter_cache) {
1581 os << "\\use_converter_cache "
1582 << convert<string>(use_converter_cache) << '\n';
1587 case RC_USE_CONVERTER_NEEDAUTH_FORBIDDEN:
1588 if (ignore_system_lyxrc ||
1589 use_converter_needauth_forbidden != system_lyxrc.use_converter_needauth_forbidden) {
1590 os << "\\use_converter_needauth_forbidden "
1591 << convert<string>(use_converter_needauth_forbidden) << '\n';
1596 case RC_USE_CONVERTER_NEEDAUTH:
1597 if (ignore_system_lyxrc ||
1598 use_converter_needauth != system_lyxrc.use_converter_needauth) {
1599 os << "\\use_converter_needauth "
1600 << convert<string>(use_converter_needauth) << '\n';
1605 case RC_CONVERTER_CACHE_MAXAGE:
1606 if (ignore_system_lyxrc ||
1607 converter_cache_maxage != system_lyxrc.converter_cache_maxage) {
1608 os << "\\converter_cache_maxage "
1609 << converter_cache_maxage << '\n';
1615 << "# SCREEN & FONTS SECTION ############################\n"
1619 if (ignore_system_lyxrc ||
1620 icon_set != system_lyxrc.icon_set) {
1621 os << "\\icon_set \"" << icon_set
1627 case RC_USE_SYSTEM_THEME_ICONS:
1628 if (ignore_system_lyxrc ||
1629 use_system_theme_icons != system_lyxrc.use_system_theme_icons) {
1630 os << "\\use_system_theme_icons "
1631 << convert<string>(use_system_theme_icons)
1638 if (ignore_system_lyxrc ||
1639 dpi != system_lyxrc.dpi) {
1640 os << "\\screen_dpi " << dpi << '\n';
1645 case RC_SCREEN_ZOOM:
1646 if (ignore_system_lyxrc ||
1647 defaultZoom != system_lyxrc.defaultZoom) {
1648 os << "\\screen_zoom " << defaultZoom << '\n';
1653 case RC_GEOMETRY_SESSION:
1654 if (ignore_system_lyxrc ||
1655 allow_geometry_session != system_lyxrc.allow_geometry_session) {
1656 os << "\\allow_geometry_session " << convert<string>(allow_geometry_session)
1662 case RC_CITATION_SEARCH:
1663 if (ignore_system_lyxrc ||
1664 citation_search != system_lyxrc.citation_search) {
1665 os << "# Set to true to use script to search\n"
1666 << "# locl disk for citation targets.\n"
1667 << "\\citation_search "
1668 << convert<string>(citation_search)
1674 case RC_CITATION_SEARCH_VIEW:
1675 if (ignore_system_lyxrc ||
1676 citation_search_view != system_lyxrc.citation_search_view) {
1677 os << "\\citation_search_view \""
1678 << citation_search_view << "\"\n";
1683 case RC_CITATION_SEARCH_PATTERN:
1684 if (ignore_system_lyxrc ||
1685 citation_search_pattern != system_lyxrc.citation_search_pattern) {
1686 os << "\\citation_search_pattern \""
1687 << citation_search_pattern << "\"\n";
1692 case RC_CT_ADDITIONS_UNDERLINED:
1693 if (ignore_system_lyxrc ||
1694 ct_additions_underlined
1695 != system_lyxrc.ct_additions_underlined) {
1696 os << "\\ct_additions_underlined "
1697 << convert<string>(ct_additions_underlined) << '\n';
1702 case RC_CT_MARKUP_COPIED:
1703 if (ignore_system_lyxrc ||
1705 != system_lyxrc.ct_markup_copied) {
1706 os << "\\ct_markup_copied "
1707 << convert<string>(ct_markup_copied) << '\n';
1712 case RC_CURSOR_FOLLOWS_SCROLLBAR:
1713 if (ignore_system_lyxrc ||
1714 cursor_follows_scrollbar
1715 != system_lyxrc.cursor_follows_scrollbar) {
1716 os << "\\cursor_follows_scrollbar "
1717 << convert<string>(cursor_follows_scrollbar) << '\n';
1722 case RC_CURSOR_WIDTH:
1723 if (ignore_system_lyxrc ||
1725 != system_lyxrc.cursor_width) {
1726 os << "\\cursor_width "
1727 << cursor_width << '\n';
1732 case RC_SCROLL_BELOW_DOCUMENT:
1733 if (ignore_system_lyxrc ||
1734 scroll_below_document
1735 != system_lyxrc.scroll_below_document) {
1736 os << "\\scroll_below_document "
1737 << convert<string>(scroll_below_document) << '\n';
1742 case RC_PARAGRAPH_MARKERS:
1743 if (ignore_system_lyxrc ||
1745 != system_lyxrc.paragraph_markers) {
1746 os << "\\paragraph_markers "
1747 << convert<string>(paragraph_markers) << '\n';
1752 case RC_BOOKMARKS_VISIBILITY:
1753 if (ignore_system_lyxrc ||
1754 bookmarks_visibility != system_lyxrc.bookmarks_visibility) {
1756 switch (bookmarks_visibility) {
1767 os << "\\experimental:bookmarks_visibility " << status << '\n';
1772 case RC_MAC_DONTSWAP_CTRL_META:
1773 if (ignore_system_lyxrc ||
1774 mac_dontswap_ctrl_meta
1775 != system_lyxrc.mac_dontswap_ctrl_meta) {
1776 os << "\\mac_dontswap_ctrl_meta "
1777 << convert<string>(mac_dontswap_ctrl_meta) << '\n';
1782 case RC_MAC_LIKE_CURSOR_MOVEMENT:
1783 if (ignore_system_lyxrc ||
1784 mac_like_cursor_movement
1785 != system_lyxrc.mac_like_cursor_movement) {
1786 os << "\\mac_like_cursor_movement "
1787 << convert<string>(mac_like_cursor_movement) << '\n';
1792 case RC_MACRO_EDIT_STYLE:
1793 if (ignore_system_lyxrc ||
1795 != system_lyxrc.macro_edit_style) {
1796 os << "\\macro_edit_style ";
1797 switch (macro_edit_style) {
1798 case MACRO_EDIT_INLINE_BOX: os << "0\n"; break;
1799 case MACRO_EDIT_INLINE: os << "1\n"; break;
1800 case MACRO_EDIT_LIST: os << "2\n"; break;
1806 case RC_DIALOGS_ICONIFY_WITH_MAIN:
1807 if (ignore_system_lyxrc ||
1808 dialogs_iconify_with_main
1809 != system_lyxrc.dialogs_iconify_with_main) {
1810 os << "\\dialogs_iconify_with_main "
1811 << convert<string>(dialogs_iconify_with_main) << '\n';
1816 case RC_SCREEN_FONT_ROMAN:
1817 if (ignore_system_lyxrc ||
1818 roman_font_name != system_lyxrc.roman_font_name) {
1819 os << "\\screen_font_roman \"" << roman_font_name
1825 case RC_SCREEN_FONT_ROMAN_FOUNDRY:
1826 if (ignore_system_lyxrc ||
1827 roman_font_foundry != system_lyxrc.roman_font_foundry) {
1828 os << "\\screen_font_roman_foundry \"" << roman_font_foundry
1834 case RC_SCREEN_FONT_SANS:
1835 if (ignore_system_lyxrc ||
1836 sans_font_name != system_lyxrc.sans_font_name) {
1837 os << "\\screen_font_sans \"" << sans_font_name
1843 case RC_SCREEN_FONT_SANS_FOUNDRY:
1844 if (ignore_system_lyxrc ||
1845 sans_font_foundry != system_lyxrc.sans_font_foundry) {
1846 os << "\\screen_font_sans_foundry \"" << sans_font_foundry
1852 case RC_SCREEN_FONT_TYPEWRITER:
1853 if (ignore_system_lyxrc ||
1854 typewriter_font_name != system_lyxrc.typewriter_font_name) {
1855 os << "\\screen_font_typewriter \""
1856 << typewriter_font_name << "\"\n";
1861 case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
1862 if (ignore_system_lyxrc ||
1863 typewriter_font_foundry != system_lyxrc.typewriter_font_foundry) {
1864 os << "\\screen_font_typewriter_foundry \""
1865 << typewriter_font_foundry << "\"\n";
1870 case RC_SCREEN_FONT_SCALABLE:
1871 if (ignore_system_lyxrc ||
1872 use_scalable_fonts != system_lyxrc.use_scalable_fonts) {
1873 os << "\\screen_font_scalable "
1874 << convert<string>(use_scalable_fonts)
1880 case RC_SCREEN_FONT_SIZES:
1881 if (ignore_system_lyxrc ||
1882 font_sizes[TINY_SIZE]
1883 != system_lyxrc.font_sizes[TINY_SIZE] ||
1884 font_sizes[SCRIPT_SIZE]
1885 != system_lyxrc.font_sizes[SCRIPT_SIZE] ||
1886 font_sizes[FOOTNOTE_SIZE]
1887 != system_lyxrc.font_sizes[FOOTNOTE_SIZE] ||
1888 font_sizes[SMALL_SIZE]
1889 != system_lyxrc.font_sizes[SMALL_SIZE] ||
1890 font_sizes[NORMAL_SIZE]
1891 != system_lyxrc.font_sizes[NORMAL_SIZE] ||
1892 font_sizes[LARGE_SIZE]
1893 != system_lyxrc.font_sizes[LARGE_SIZE] ||
1894 font_sizes[LARGER_SIZE]
1895 != system_lyxrc.font_sizes[LARGER_SIZE] ||
1896 font_sizes[LARGEST_SIZE]
1897 != system_lyxrc.font_sizes[LARGEST_SIZE] ||
1898 font_sizes[HUGE_SIZE]
1899 != system_lyxrc.font_sizes[HUGE_SIZE] ||
1900 font_sizes[HUGER_SIZE]
1901 != system_lyxrc.font_sizes[HUGER_SIZE]) {
1902 streamsize old_prec = os.precision();
1903 os.setf(ios::fixed);
1905 os << "\\screen_font_sizes"
1906 << ' ' << font_sizes[TINY_SIZE]
1907 << ' ' << font_sizes[SCRIPT_SIZE]
1908 << ' ' << font_sizes[FOOTNOTE_SIZE]
1909 << ' ' << font_sizes[SMALL_SIZE]
1910 << ' ' << font_sizes[NORMAL_SIZE]
1911 << ' ' << font_sizes[LARGE_SIZE]
1912 << ' ' << font_sizes[LARGER_SIZE]
1913 << ' ' << font_sizes[LARGEST_SIZE]
1914 << ' ' << font_sizes[HUGE_SIZE]
1915 << ' ' << font_sizes[HUGER_SIZE]
1917 os.precision(old_prec);
1918 os.unsetf(ios::fixed);
1923 case RC_FULL_SCREEN_LIMIT:
1924 if (ignore_system_lyxrc ||
1925 full_screen_limit != system_lyxrc.full_screen_limit) {
1926 os << "\\fullscreen_limit "
1927 << convert<string>(full_screen_limit)
1933 case RC_FULL_SCREEN_TOOLBARS:
1934 if (ignore_system_lyxrc ||
1935 full_screen_toolbars != system_lyxrc.full_screen_toolbars) {
1936 os << "\\fullscreen_toolbars "
1937 << convert<string>(full_screen_toolbars)
1943 case RC_FULL_SCREEN_SCROLLBAR:
1944 if (ignore_system_lyxrc ||
1945 full_screen_scrollbar != system_lyxrc.full_screen_scrollbar) {
1946 os << "\\fullscreen_scrollbar "
1947 << convert<string>(full_screen_scrollbar)
1953 case RC_FULL_SCREEN_STATUSBAR:
1954 if (ignore_system_lyxrc ||
1955 full_screen_statusbar != system_lyxrc.full_screen_statusbar) {
1956 os << "\\fullscreen_statusbar "
1957 << convert<string>(full_screen_statusbar)
1963 case RC_FULL_SCREEN_TABBAR:
1964 if (ignore_system_lyxrc ||
1965 full_screen_tabbar != system_lyxrc.full_screen_tabbar) {
1966 os << "\\fullscreen_tabbar "
1967 << convert<string>(full_screen_tabbar)
1973 case RC_FULL_SCREEN_MENUBAR:
1974 if (ignore_system_lyxrc ||
1975 full_screen_menubar != system_lyxrc.full_screen_menubar) {
1976 os << "\\fullscreen_menubar "
1977 << convert<string>(full_screen_menubar)
1983 case RC_FULL_SCREEN_WIDTH:
1984 if (ignore_system_lyxrc ||
1985 full_screen_width != system_lyxrc.full_screen_width) {
1986 os << "\\fullscreen_width "
1987 << convert<string>(full_screen_width)
1993 case RC_OPEN_BUFFERS_IN_TABS:
1994 if (ignore_system_lyxrc ||
1995 open_buffers_in_tabs != system_lyxrc.open_buffers_in_tabs) {
1996 os << "\\open_buffers_in_tabs "
1997 << convert<string>(open_buffers_in_tabs)
2003 case RC_SINGLE_CLOSE_TAB_BUTTON:
2004 if (ignore_system_lyxrc ||
2005 single_close_tab_button != system_lyxrc.single_close_tab_button) {
2006 os << "\\single_close_tab_button "
2007 << convert<string>(single_close_tab_button)
2013 case RC_SINGLE_INSTANCE:
2014 if (ignore_system_lyxrc ||
2015 single_instance != system_lyxrc.single_instance) {
2016 os << "\\single_instance "
2017 << convert<string>(single_instance)
2023 case RC_FORWARD_SEARCH_DVI:
2024 if (ignore_system_lyxrc ||
2025 forward_search_dvi != system_lyxrc.forward_search_dvi) {
2026 os << "\\forward_search_dvi \"" << escapeCommand(forward_search_dvi) << "\"\n";
2031 case RC_FORWARD_SEARCH_PDF:
2032 if (ignore_system_lyxrc ||
2033 forward_search_pdf != system_lyxrc.forward_search_pdf) {
2034 os << "\\forward_search_pdf \"" << escapeCommand(forward_search_pdf) << "\"\n";
2039 case RC_DRAW_STRATEGY:
2040 if (ignore_system_lyxrc ||
2041 draw_strategy != system_lyxrc.draw_strategy) {
2043 switch (draw_strategy) {
2047 case DS_BACKINGSTORE:
2048 status = "backingstore";
2051 os << "\\draw_strategy " << status << '\n';
2058 << "# COLOR SECTION ###################################\n"
2063 for (int i = 0; i < Color_ignore; ++i) {
2064 ColorCode lc = static_cast<ColorCode>(i);
2065 string const col = lcolor.getAllX11HexNames(lc).first;
2066 string const darkcol = lcolor.getAllX11HexNames(lc).second;
2067 if (ignore_system_lyxrc
2068 || col != system_lcolor.getAllX11HexNames(lc).first
2069 || darkcol != system_lcolor.getAllX11HexNames(lc).second) {
2070 os << "\\set_color \""
2071 << lcolor.getLyXName(lc) << "\" \""
2073 << darkcol << "\"\n";
2080 << "# PRINTER SECTION ###################################\n"
2084 case RC_PRINTLANDSCAPEFLAG:
2085 if (ignore_system_lyxrc ||
2086 print_landscape_flag != system_lyxrc.print_landscape_flag) {
2087 os << "\\print_landscape_flag \"" << print_landscape_flag
2093 case RC_PRINTPAPERFLAG:
2094 if (ignore_system_lyxrc ||
2095 print_paper_flag != system_lyxrc.print_paper_flag) {
2096 os << "\\print_paper_flag \"" << print_paper_flag
2102 case RC_PRINTPAPERDIMENSIONFLAG:
2103 if (ignore_system_lyxrc ||
2104 print_paper_dimension_flag
2105 != system_lyxrc.print_paper_dimension_flag) {
2106 os << "\\print_paper_dimension_flag \""
2107 << print_paper_dimension_flag << "\"\n";
2113 << "# TEX SECTION #######################################\n"
2117 case RC_TEXINPUTS_PREFIX:
2118 if (ignore_system_lyxrc ||
2119 texinputs_prefix != system_lyxrc.texinputs_prefix) {
2120 os << "\\texinputs_prefix \"" << texinputs_prefix << "\"\n";
2126 << "# FILE SECTION ######################################\n"
2129 case RC_DOCUMENTPATH:
2130 if (ignore_system_lyxrc ||
2131 document_path != system_lyxrc.document_path) {
2132 string const path = os::external_path(document_path);
2133 os << "\\document_path \"" << path << "\"\n";
2138 case RC_USELASTFILEPOS:
2139 if (ignore_system_lyxrc ||
2140 use_lastfilepos != system_lyxrc.use_lastfilepos) {
2141 os << "\\use_lastfilepos " << convert<string>(use_lastfilepos)
2147 case RC_LOADSESSION:
2148 if (ignore_system_lyxrc ||
2149 load_session != system_lyxrc.load_session) {
2150 os << "\\load_session " << convert<string>(load_session)
2156 case RC_MOUSE_WHEEL_SPEED:
2157 if (ignore_system_lyxrc ||
2158 mouse_wheel_speed != system_lyxrc.mouse_wheel_speed) {
2159 os << "\\mouse_wheel_speed " << mouse_wheel_speed << '\n';
2164 case RC_MOUSE_MIDDLEBUTTON_PASTE:
2165 if (ignore_system_lyxrc ||
2166 mouse_middlebutton_paste != system_lyxrc.mouse_middlebutton_paste) {
2167 os << "\\mouse_middlebutton_paste "
2168 << convert<string>(mouse_middlebutton_paste) << '\n';
2173 case RC_COMPLETION_INLINE_DELAY:
2174 if (ignore_system_lyxrc ||
2175 completion_inline_delay != system_lyxrc.completion_inline_delay) {
2176 os << "\\completion_inline_delay " << completion_inline_delay << '\n';
2181 case RC_COMPLETION_INLINE_MATH:
2182 if (ignore_system_lyxrc ||
2183 completion_inline_math != system_lyxrc.completion_inline_math) {
2184 os << "\\completion_inline_math "
2185 << convert<string>(completion_inline_math) << '\n';
2190 case RC_COMPLETION_INLINE_TEXT:
2191 if (ignore_system_lyxrc ||
2192 completion_inline_text != system_lyxrc.completion_inline_text) {
2193 os << "\\completion_inline_text "
2194 << convert<string>(completion_inline_text) << '\n';
2199 case RC_COMPLETION_INLINE_DOTS:
2200 if (ignore_system_lyxrc ||
2201 completion_inline_dots != system_lyxrc.completion_inline_dots) {
2202 os << "\\completion_inline_dots "
2203 << convert<string>(completion_inline_dots) << '\n';
2208 case RC_AUTOCORRECTION_MATH:
2209 if (ignore_system_lyxrc ||
2210 autocorrection_math != system_lyxrc.autocorrection_math) {
2211 os << "\\autocorrection_math "
2212 << convert<string>(autocorrection_math) << '\n';
2217 case RC_COMPLETION_POPUP_DELAY:
2218 if (ignore_system_lyxrc ||
2219 completion_popup_delay != system_lyxrc.completion_popup_delay) {
2220 os << "\\completion_popup_delay " << completion_popup_delay << '\n';
2225 case RC_COMPLETION_POPUP_MATH:
2226 if (ignore_system_lyxrc ||
2227 completion_popup_math != system_lyxrc.completion_popup_math) {
2228 os << "\\completion_popup_math "
2229 << convert<string>(completion_popup_math) << '\n';
2234 case RC_COMPLETION_POPUP_TEXT:
2235 if (ignore_system_lyxrc ||
2236 completion_popup_text != system_lyxrc.completion_popup_text) {
2237 os << "\\completion_popup_text "
2238 << convert<string>(completion_popup_text) << '\n';
2243 case RC_COMPLETION_CURSOR_TEXT:
2244 if (ignore_system_lyxrc ||
2245 completion_cursor_text != system_lyxrc.completion_cursor_text) {
2246 os << "\\completion_cursor_text "
2247 << convert<string>(completion_cursor_text) << '\n';
2252 case RC_COMPLETION_POPUP_AFTER_COMPLETE:
2253 if (ignore_system_lyxrc ||
2254 completion_popup_after_complete
2255 != system_lyxrc.completion_popup_after_complete) {
2256 os << "\\completion_popup_after_complete "
2257 << convert<string>(completion_popup_after_complete) << '\n';
2262 case RC_COMPLETION_MINLENGTH:
2263 if (ignore_system_lyxrc ||
2264 completion_minlength != system_lyxrc.completion_minlength) {
2265 os << "\\completion_minlength " << convert<string>(completion_minlength)
2271 case RC_NUMLASTFILES:
2272 if (ignore_system_lyxrc ||
2273 num_lastfiles != system_lyxrc.num_lastfiles) {
2274 os << "\\num_lastfiles " << num_lastfiles << '\n';
2279 case RC_CHECKLASTFILES:
2280 if (ignore_system_lyxrc ||
2281 check_lastfiles != system_lyxrc.check_lastfiles) {
2282 os << "\\check_lastfiles " << convert<string>(check_lastfiles)
2288 case RC_EXAMPLEPATH:
2289 if (ignore_system_lyxrc ||
2290 example_path != system_lyxrc.example_path) {
2291 string const path = os::external_path(example_path);
2292 os << "\\example_path \"" << path << "\"\n";
2297 case RC_TEMPLATEPATH:
2298 if (ignore_system_lyxrc ||
2299 template_path != system_lyxrc.template_path) {
2300 string const path = os::external_path(template_path);
2301 os << "\\template_path \"" << path << "\"\n";
2306 case RC_TEMPDIRPATH:
2307 if (ignore_system_lyxrc ||
2308 tempdir_path != system_lyxrc.tempdir_path) {
2309 string const path = os::external_path(tempdir_path);
2310 os << "\\tempdir_path \"" << path << "\"\n";
2315 case RC_THESAURUSDIRPATH:
2316 if (ignore_system_lyxrc ||
2317 thesaurusdir_path != system_lyxrc.thesaurusdir_path) {
2318 string const path = os::external_path(thesaurusdir_path);
2319 os << "\\thesaurusdir_path \"" << path << "\"\n";
2324 case RC_HUNSPELLDIR_PATH:
2325 if (ignore_system_lyxrc ||
2326 hunspelldir_path != system_lyxrc.hunspelldir_path) {
2327 string const path = os::external_path(hunspelldir_path);
2328 os << "\\hunspelldir_path \"" << path << "\"\n";
2333 case RC_PLAINTEXT_LINELEN:
2334 if (ignore_system_lyxrc ||
2335 plaintext_linelen != system_lyxrc.plaintext_linelen) {
2336 os << "\\plaintext_linelen " << plaintext_linelen << '\n';
2341 case RC_MAKE_BACKUP:
2342 if (ignore_system_lyxrc ||
2343 make_backup != system_lyxrc.make_backup) {
2344 os << "\\make_backup " << convert<string>(make_backup) << '\n';
2349 case RC_SAVE_COMPRESSED:
2350 if (ignore_system_lyxrc ||
2351 save_compressed != system_lyxrc.save_compressed) {
2352 os << "\\save_compressed " << convert<string>(save_compressed) << '\n';
2357 case RC_SAVE_ORIGIN:
2358 if (ignore_system_lyxrc ||
2359 save_origin != system_lyxrc.save_origin) {
2360 os << "\\save_origin " << convert<string>(save_origin) << '\n';
2365 case RC_BACKUPDIR_PATH:
2366 if (ignore_system_lyxrc ||
2367 backupdir_path != system_lyxrc.backupdir_path) {
2368 string const path = os::external_path(backupdir_path);
2369 os << "\\backupdir_path \"" << path << "\"\n";
2375 << "# PLAIN TEXT EXPORT SECTION ##############################\n"
2379 << "# SPELLCHECKER SECTION ##############################\n"
2383 case RC_ACCEPT_COMPOUND:
2384 if (ignore_system_lyxrc ||
2385 spellchecker_accept_compound != system_lyxrc.spellchecker_accept_compound) {
2386 os << "\\accept_compound " << convert<string>(spellchecker_accept_compound)
2393 if (ignore_system_lyxrc ||
2394 spellchecker_alt_lang != system_lyxrc.spellchecker_alt_lang) {
2395 os << "\\alternate_language \"" << spellchecker_alt_lang
2402 if (ignore_system_lyxrc ||
2403 spellchecker_esc_chars != system_lyxrc.spellchecker_esc_chars) {
2404 os << "\\escape_chars \"" << spellchecker_esc_chars << "\"\n";
2409 case RC_USE_NATIVE_FILEDIALOG:
2410 if (ignore_system_lyxrc ||
2411 use_native_filedialog != system_lyxrc.use_native_filedialog) {
2412 os << "\\use_native_filedialog "
2413 << convert<string>(use_native_filedialog)
2419 case RC_USE_SYSTEM_COLORS:
2420 if (ignore_system_lyxrc ||
2421 use_system_colors != system_lyxrc.use_system_colors) {
2422 os << "\\use_system_colors "
2423 << convert<string>(use_system_colors)
2429 case RC_USE_TOOLTIP:
2430 if (ignore_system_lyxrc ||
2431 use_tooltip != system_lyxrc.use_tooltip) {
2432 os << "\\use_tooltip "
2433 << convert<string>(use_tooltip)
2441 << "# LANGUAGE SUPPORT SECTION ##########################\n"
2445 case RC_DEFAULT_DECIMAL_SEP:
2446 if (ignore_system_lyxrc ||
2447 default_decimal_sep != system_lyxrc.default_decimal_sep) {
2448 os << "\\default_decimal_point \"" << default_decimal_sep << "\"" << '\n';
2453 case RC_DEFAULT_LENGTH_UNIT:
2454 if (ignore_system_lyxrc ||
2455 default_length_unit != system_lyxrc.default_length_unit) {
2456 os << "\\default_length_unit " << int(default_length_unit) << '\n';
2461 case RC_SPELLCHECKER:
2462 if (ignore_system_lyxrc ||
2463 spellchecker != system_lyxrc.spellchecker) {
2464 os << "\\spellchecker " << spellchecker << '\n';
2469 case RC_SPELLCHECK_CONTINUOUSLY:
2470 if (ignore_system_lyxrc ||
2471 spellcheck_continuously != system_lyxrc.spellcheck_continuously) {
2472 os << "\\spellcheck_continuously " << convert<string>(spellcheck_continuously)
2478 case RC_SPELLCHECK_NOTES:
2479 if (ignore_system_lyxrc ||
2480 spellcheck_notes != system_lyxrc.spellcheck_notes) {
2481 os << "\\spellcheck_notes " << convert<string>(spellcheck_notes)
2487 case RC_VISUAL_CURSOR:
2488 if (ignore_system_lyxrc ||
2489 visual_cursor != system_lyxrc.visual_cursor) {
2490 os << "\\visual_cursor " << convert<string>(visual_cursor) << '\n';
2495 case RC_CLOSE_BUFFER_WITH_LAST_VIEW:
2496 if (ignore_system_lyxrc ||
2497 close_buffer_with_last_view != system_lyxrc.close_buffer_with_last_view) {
2498 os << "# When closing last view, buffer closes (yes), hides (no), or ask the user (ask)\n";
2499 os << "\\close_buffer_with_last_view " << close_buffer_with_last_view << '\n';
2504 case RC_LANGUAGE_CUSTOM_PACKAGE:
2505 if (ignore_system_lyxrc ||
2506 language_custom_package != system_lyxrc.language_custom_package) {
2507 os << "\\language_custom_package \"" << language_custom_package
2513 case RC_LANGUAGE_GLOBAL_OPTIONS:
2514 if (ignore_system_lyxrc ||
2515 language_global_options
2516 != system_lyxrc.language_global_options) {
2517 os << "\\language_global_options \""
2518 << convert<string>(language_global_options)
2524 case RC_LANGUAGE_PACKAGE_SELECTION:
2525 if (ignore_system_lyxrc ||
2526 language_package_selection != system_lyxrc.language_package_selection) {
2527 os << "\\language_package_selection ";
2528 switch (language_package_selection) {
2546 case RC_LANGUAGE_COMMAND_BEGIN:
2547 if (ignore_system_lyxrc ||
2548 language_command_begin
2549 != system_lyxrc.language_command_begin) {
2550 os << "\\language_command_begin \""
2551 << language_command_begin
2557 case RC_LANGUAGE_COMMAND_END:
2558 if (ignore_system_lyxrc ||
2559 language_command_end
2560 != system_lyxrc.language_command_end) {
2561 os << "\\language_command_end \"" << language_command_end
2567 case RC_LANGUAGE_COMMAND_LOCAL:
2568 if (ignore_system_lyxrc ||
2569 language_command_local
2570 != system_lyxrc.language_command_local) {
2571 os << "\\language_command_local \""
2572 << language_command_local
2578 case RC_LANGUAGE_AUTO_BEGIN:
2579 if (ignore_system_lyxrc ||
2580 language_auto_begin != system_lyxrc.language_auto_begin) {
2581 os << "\\language_auto_begin "
2582 << convert<string>(language_auto_begin) << '\n';
2587 case RC_LANGUAGE_AUTO_END:
2588 if (ignore_system_lyxrc ||
2589 language_auto_end != system_lyxrc.language_auto_end) {
2590 os << "\\language_auto_end "
2591 << convert<string>(language_auto_end) << '\n';
2596 case RC_MARK_FOREIGN_LANGUAGE:
2597 if (ignore_system_lyxrc ||
2598 mark_foreign_language
2599 != system_lyxrc.mark_foreign_language) {
2600 os << "\\mark_foreign_language " <<
2601 convert<string>(mark_foreign_language) << '\n';
2604 case RC_RESPECT_OS_KBD_LANGUAGE:
2605 if (ignore_system_lyxrc ||
2606 respect_os_kbd_language
2607 != system_lyxrc.respect_os_kbd_language) {
2608 os << "\\respect_os_kbd_language " <<
2609 convert<string>(respect_os_kbd_language) << '\n';
2616 << "# 2nd MISC SUPPORT SECTION ##########################\n"
2620 case RC_AUTO_NUMBER:
2621 if (ignore_system_lyxrc ||
2622 auto_number != system_lyxrc.auto_number) {
2623 os << "\\auto_number " << convert<string>(auto_number) << '\n';
2628 case RC_GUI_LANGUAGE:
2629 if (ignore_system_lyxrc ||
2630 gui_language != system_lyxrc.gui_language) {
2631 os << "\\gui_language " << gui_language << '\n';
2636 case RC_EXPORT_OVERWRITE:
2637 if (ignore_system_lyxrc ||
2638 export_overwrite != system_lyxrc.export_overwrite) {
2640 switch (export_overwrite) {
2651 os << "\\export_overwrite " << status << '\n';
2656 case RC_SCROLL_WHEEL_ZOOM:
2657 if (ignore_system_lyxrc ||
2658 scroll_wheel_zoom != system_lyxrc.scroll_wheel_zoom) {
2660 switch (scroll_wheel_zoom) {
2661 case SCROLL_WHEEL_ZOOM_OFF:
2664 case SCROLL_WHEEL_ZOOM_CTRL:
2667 case SCROLL_WHEEL_ZOOM_SHIFT:
2670 case SCROLL_WHEEL_ZOOM_ALT:
2674 os << "\\scroll_wheel_zoom " << status << '\n';
2680 << "# FORMATS SECTION ##########################\n"
2685 // New/modified formats
2686 for (Formats::const_iterator cit = theFormats().begin();
2687 cit != theFormats().end(); ++cit) {
2688 Format const * format =
2689 theSystemFormats().getFormat(cit->name());
2691 format->extensions() != cit->extensions() ||
2692 format->prettyname() != cit->prettyname() ||
2693 format->shortcut() != cit->shortcut() ||
2694 format->viewer() != cit->viewer() ||
2695 format->editor() != cit->editor() ||
2696 format->documentFormat() != cit->documentFormat() ||
2697 format->vectorFormat() != cit->vectorFormat() ||
2698 format->inExportMenu() != cit->inExportMenu() ||
2699 format->noMenu() != cit->noMenu() ||
2700 format->mime() != cit->mime()) {
2701 os << "\\format \"" << cit->name() << "\" \""
2702 << cit->extensions() << "\" \""
2703 << to_utf8(cit->prettyname()) << "\" \""
2704 << cit->shortcut() << "\" \""
2705 << escapeCommand(cit->viewer()) << "\" \""
2706 << escapeCommand(cit->editor()) << "\" \"";
2707 vector<string> flags;
2708 if (cit->documentFormat())
2709 flags.push_back("document");
2710 if (cit->vectorFormat())
2711 flags.push_back("vector");
2712 if (cit->zippedNative())
2713 flags.push_back("zipped=native");
2714 if (cit->inExportMenu())
2715 flags.push_back("menu=export");
2717 os << getStringFromVector(flags);
2718 os << "\" \"" << cit->mime() << "\"\n";
2722 // Look for deleted formats
2723 for (Formats::const_iterator cit = theSystemFormats().begin();
2724 cit != theSystemFormats().end(); ++cit)
2725 if (!theFormats().getFormat(cit->name()))
2726 os << "\\format \"" << cit->name()
2727 << "\" \"\" \"\" \"\" \"\" \"\" \"\" \"\"\n";
2731 case RC_VIEWER_ALTERNATIVES: {
2732 Alternatives::const_iterator it = viewer_alternatives.begin();
2733 Alternatives::const_iterator const en = viewer_alternatives.end();
2734 Alternatives::const_iterator const sysend =
2735 system_lyxrc.viewer_alternatives.end();
2736 for (; it != en; ++it) {
2737 string const & fmt = it->first;
2738 CommandSet const & cmd = it->second;
2739 CommandSet::const_iterator sit = cmd.begin();
2740 CommandSet::const_iterator const sen = cmd.end();
2741 Alternatives::const_iterator const sysfmt = ignore_system_lyxrc ?
2742 system_lyxrc.viewer_alternatives.begin() : // we won't use it in this case
2743 system_lyxrc.viewer_alternatives.find(fmt);
2744 for (; sit != sen; ++sit) {
2745 string const & cmd = *sit;
2746 if (ignore_system_lyxrc
2747 || sysfmt == sysend // format not found
2748 || sysfmt->second.count(cmd) == 0 // this command not found
2750 os << "\\viewer_alternatives " << fmt << " \"" << escapeCommand(cmd) << "\"\n";
2757 case RC_EDITOR_ALTERNATIVES: {
2758 Alternatives::const_iterator it = editor_alternatives.begin();
2759 Alternatives::const_iterator const en = editor_alternatives.end();
2760 Alternatives::const_iterator const sysend =
2761 system_lyxrc.editor_alternatives.end();
2762 for (; it != en; ++it) {
2763 string const & fmt = it->first;
2764 CommandSet const & cmd = it->second;
2765 CommandSet::const_iterator sit = cmd.begin();
2766 CommandSet::const_iterator const sen = cmd.end();
2767 Alternatives::const_iterator const sysfmt = ignore_system_lyxrc ?
2768 system_lyxrc.editor_alternatives.begin() : // we won't use it in this case
2769 system_lyxrc.editor_alternatives.find(fmt);
2770 for (; sit != sen; ++sit) {
2771 string const & cmd = *sit;
2772 if (ignore_system_lyxrc
2773 || sysfmt == sysend // format not found
2774 || sysfmt->second.count(cmd) == 0 // this command not found
2776 os << "\\editor_alternatives " << fmt << " \"" << escapeCommand(cmd) << "\"\n";
2783 case RC_DEFAULT_OTF_VIEW_FORMAT:
2784 if ((ignore_system_lyxrc ||
2785 default_otf_view_format != system_lyxrc.default_otf_view_format)
2786 && !default_otf_view_format.empty()) {
2787 os << "\\default_otf_view_format " << default_otf_view_format << '\n';
2792 case RC_DEFAULT_PLATEX_VIEW_FORMAT:
2793 if ((ignore_system_lyxrc ||
2794 default_platex_view_format != system_lyxrc.default_platex_view_format)
2795 && !default_platex_view_format.empty()) {
2796 os << "\\default_platex_view_format " << default_platex_view_format << '\n';
2801 case RC_DEFAULT_VIEW_FORMAT:
2802 if ((ignore_system_lyxrc ||
2803 default_view_format != system_lyxrc.default_view_format)
2804 && !default_view_format.empty()) {
2805 os << "\\default_view_format " << default_view_format << '\n';
2816 << "# CONVERTERS SECTION ##########################\n"
2821 // Look for new converters
2822 for (Converters::const_iterator cit = theConverters().begin();
2823 cit != theConverters().end(); ++cit) {
2824 Converter const * converter =
2825 theSystemConverters().getConverter(cit->from(),
2828 converter->command() != cit->command() ||
2829 converter->flags() != cit->flags())
2830 os << "\\converter \"" << cit->from() << "\" \""
2831 << cit->to() << "\" \""
2832 << escapeCommand(cit->command()) << "\" \""
2833 << cit->flags() << "\"\n";
2836 // New/modifed converters
2837 for (Converters::const_iterator cit = theSystemConverters().begin();
2838 cit != theSystemConverters().end(); ++cit)
2839 if (!theConverters().getConverter(cit->from(), cit->to()))
2840 os << "\\converter \"" << cit->from()
2841 << "\" \"" << cit->to() << "\" \"\" \"\"\n";
2848 << "# COPIERS SECTION ##########################\n"
2851 // Look for new movers
2852 Movers::const_iterator const sysbegin = theSystemMovers().begin();
2853 Movers::const_iterator const sysend = theSystemMovers().end();
2854 Movers::const_iterator it = theMovers().begin();
2855 Movers::const_iterator end = theMovers().end();
2857 for (; it != end; ++it) {
2858 Movers::const_iterator const sysit =
2859 find_if(sysbegin, sysend, SameMover(*it));
2860 if (sysit == sysend) {
2861 string const & fmt = it->first;
2862 string const & command =
2863 it->second.command();
2865 os << "\\copier " << fmt
2866 << " \"" << escapeCommand(command) << "\"\n";
2872 // We don't actually delete SpecialisedMover(s) from the
2873 // map, just clear their 'command', so there's no need
2874 // to test for anything else.
2881 void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new)
2883 // Why the switch you might ask. It is a trick to ensure that all
2884 // the elements in the LyXRCTags enum is handled. As you can see
2885 // there are no breaks at all. So it is just a huge fall-through.
2886 // The nice thing is that we will get a warning from the compiler
2887 // if we forget an element.
2888 LyXRC::LyXRCTags tag = LyXRC::RC_LAST;
2890 case LyXRC::RC_LAST:
2891 case LyXRC::RC_ACCEPT_COMPOUND:
2892 if (lyxrc_orig.spellchecker_accept_compound != lyxrc_new.spellchecker_accept_compound)
2893 if (theSpellChecker()) theSpellChecker()->advanceChangeNumber();
2895 case LyXRC::RC_ALT_LANG:
2896 case LyXRC::RC_PLAINTEXT_LINELEN:
2897 case LyXRC::RC_AUTOCORRECTION_MATH:
2898 case LyXRC::RC_AUTOREGIONDELETE:
2899 case LyXRC::RC_AUTORESET_OPTIONS:
2900 case LyXRC::RC_AUTOSAVE:
2901 case LyXRC::RC_AUTO_NUMBER:
2902 case LyXRC::RC_BACKUPDIR_PATH:
2903 case LyXRC::RC_BIBTEX_ALTERNATIVES:
2904 case LyXRC::RC_BIBTEX_COMMAND:
2905 case LyXRC::RC_BINDFILE:
2906 case LyXRC::RC_BOOKMARKS_VISIBILITY:
2907 case LyXRC::RC_CITATION_SEARCH:
2908 case LyXRC::RC_CITATION_SEARCH_PATTERN:
2909 case LyXRC::RC_CITATION_SEARCH_VIEW:
2910 case LyXRC::RC_CHECKLASTFILES:
2911 case LyXRC::RC_COMPLETION_CURSOR_TEXT:
2912 case LyXRC::RC_COMPLETION_INLINE_DELAY:
2913 case LyXRC::RC_COMPLETION_INLINE_DOTS:
2914 case LyXRC::RC_COMPLETION_INLINE_MATH:
2915 case LyXRC::RC_COMPLETION_INLINE_TEXT:
2916 case LyXRC::RC_COMPLETION_POPUP_AFTER_COMPLETE:
2917 case LyXRC::RC_COMPLETION_POPUP_DELAY:
2918 case LyXRC::RC_COMPLETION_POPUP_MATH:
2919 case LyXRC::RC_COMPLETION_POPUP_TEXT:
2920 case LyXRC::RC_COMPLETION_MINLENGTH:
2921 case LyXRC::RC_USELASTFILEPOS:
2922 case LyXRC::RC_LOADSESSION:
2923 case LyXRC::RC_CHKTEX_COMMAND:
2924 case LyXRC::RC_CONVERTER:
2925 case LyXRC::RC_CONVERTER_CACHE_MAXAGE:
2926 case LyXRC::RC_COPIER:
2927 case LyXRC::RC_CT_ADDITIONS_UNDERLINED:
2928 case LyXRC::RC_CT_MARKUP_COPIED:
2929 case LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR:
2930 case LyXRC::RC_SCROLL_BELOW_DOCUMENT:
2931 case LyXRC::RC_GUI_LANGUAGE:
2932 case LyXRC::RC_DEFAULT_OTF_VIEW_FORMAT:
2933 case LyXRC::RC_DEFAULT_PLATEX_VIEW_FORMAT:
2934 case LyXRC::RC_DEFAULT_VIEW_FORMAT:
2935 case LyXRC::RC_DEFFILE:
2936 case LyXRC::RC_DIALOGS_ICONIFY_WITH_MAIN:
2937 case LyXRC::RC_DISPLAY_GRAPHICS:
2938 case LyXRC::RC_DOCUMENTPATH:
2939 if (lyxrc_orig.document_path != lyxrc_new.document_path) {
2940 FileName path(lyxrc_new.document_path);
2941 if (path.exists() && path.isDirectory())
2942 package().document_dir() = FileName(lyxrc.document_path);
2945 case LyXRC::RC_DRAW_STRATEGY:
2946 case LyXRC::RC_EDITOR_ALTERNATIVES:
2947 case LyXRC::RC_ESC_CHARS:
2948 case LyXRC::RC_EXAMPLEPATH:
2949 case LyXRC::RC_FILEFORMAT:
2950 case LyXRC::RC_GROUP_LAYOUTS:
2951 case LyXRC::RC_HUNSPELLDIR_PATH:
2952 case LyXRC::RC_ICON_SET:
2953 case LyXRC::RC_INDEX_ALTERNATIVES:
2954 case LyXRC::RC_INDEX_COMMAND:
2955 case LyXRC::RC_JBIBTEX_COMMAND:
2956 case LyXRC::RC_JBIBTEX_ALTERNATIVES:
2957 case LyXRC::RC_JINDEX_COMMAND:
2958 case LyXRC::RC_NOMENCL_COMMAND:
2959 case LyXRC::RC_PYGMENTIZE_COMMAND:
2960 case LyXRC::RC_INPUT:
2961 case LyXRC::RC_KBMAP:
2962 case LyXRC::RC_KBMAP_PRIMARY:
2963 case LyXRC::RC_KBMAP_SECONDARY:
2964 case LyXRC::RC_LANGUAGE_AUTO_BEGIN:
2965 case LyXRC::RC_LANGUAGE_AUTO_END:
2966 case LyXRC::RC_LANGUAGE_COMMAND_BEGIN:
2967 case LyXRC::RC_LANGUAGE_COMMAND_END:
2968 case LyXRC::RC_LANGUAGE_COMMAND_LOCAL:
2969 case LyXRC::RC_LANGUAGE_GLOBAL_OPTIONS:
2970 case LyXRC::RC_LANGUAGE_CUSTOM_PACKAGE:
2971 case LyXRC::RC_LANGUAGE_PACKAGE_SELECTION:
2972 case LyXRC::RC_LYXRCFORMAT:
2973 case LyXRC::RC_MAC_DONTSWAP_CTRL_META:
2974 case LyXRC::RC_MAC_LIKE_CURSOR_MOVEMENT:
2975 case LyXRC::RC_MACRO_EDIT_STYLE:
2976 case LyXRC::RC_MAKE_BACKUP:
2977 case LyXRC::RC_MARK_FOREIGN_LANGUAGE:
2978 case LyXRC::RC_RESPECT_OS_KBD_LANGUAGE:
2979 case LyXRC::RC_MOUSE_WHEEL_SPEED:
2980 case LyXRC::RC_MOUSE_MIDDLEBUTTON_PASTE:
2981 case LyXRC::RC_NUMLASTFILES:
2982 case LyXRC::RC_PARAGRAPH_MARKERS:
2983 case LyXRC::RC_PATH_PREFIX:
2984 if (lyxrc_orig.path_prefix != lyxrc_new.path_prefix) {
2985 prependEnvPath("PATH", replaceEnvironmentPath(lyxrc_new.path_prefix));
2986 // Resets python path
2987 support::os::python(true);
2990 case LyXRC::RC_PREVIEW:
2991 if (lyxrc_orig.preview != lyxrc_new.preview) {
2992 // Update all previews of all documents.
2993 /* FIXME: this can be very expensive. It would be cheaper
2994 * to kill all existing previews and update visible
2996 theBufferList().updatePreviews();
2999 case LyXRC::RC_PREVIEW_HASHED_LABELS:
3000 case LyXRC::RC_PREVIEW_SCALE_FACTOR:
3001 case LyXRC::RC_PRINTLANDSCAPEFLAG:
3002 case LyXRC::RC_PRINTPAPERDIMENSIONFLAG:
3003 case LyXRC::RC_PRINTPAPERFLAG:
3004 case LyXRC::RC_SAVE_COMPRESSED:
3005 case LyXRC::RC_SAVE_ORIGIN:
3006 case LyXRC::RC_SCREEN_DPI:
3008 case LyXRC::RC_SCREEN_FONT_ROMAN:
3009 case LyXRC::RC_SCREEN_FONT_ROMAN_FOUNDRY:
3010 case LyXRC::RC_SCREEN_FONT_SANS:
3011 case LyXRC::RC_SCREEN_FONT_SANS_FOUNDRY:
3012 case LyXRC::RC_SCREEN_FONT_SCALABLE:
3013 case LyXRC::RC_SCREEN_FONT_SIZES:
3014 case LyXRC::RC_SCREEN_FONT_TYPEWRITER:
3015 case LyXRC::RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
3016 case LyXRC::RC_SCREEN_ZOOM:
3017 if (lyxrc_orig.roman_font_name != lyxrc_new.roman_font_name
3018 || lyxrc_orig.sans_font_name != lyxrc_new.sans_font_name
3019 || lyxrc_orig.typewriter_font_name != lyxrc_new.typewriter_font_name
3020 || lyxrc_orig.roman_font_foundry != lyxrc_new.roman_font_foundry
3021 || lyxrc_orig.sans_font_foundry != lyxrc_new.sans_font_foundry
3022 || lyxrc_orig.use_scalable_fonts != lyxrc_new.use_scalable_fonts
3023 || !std::equal(std::begin(lyxrc_orig.font_sizes), std::end(lyxrc_orig.font_sizes),
3024 std::begin(lyxrc_new.font_sizes))
3025 || lyxrc_orig.typewriter_font_foundry != lyxrc_new.typewriter_font_foundry
3026 || lyxrc_orig.defaultZoom != lyxrc_new.defaultZoom) {
3027 dispatch(FuncRequest(LFUN_SCREEN_FONT_UPDATE));
3030 case LyXRC::RC_GEOMETRY_SESSION:
3031 case LyXRC::RC_SERVERPIPE:
3032 case LyXRC::RC_SET_COLOR:
3033 case LyXRC::RC_SHOW_BANNER:
3034 case LyXRC::RC_OPEN_BUFFERS_IN_TABS:
3035 case LyXRC::RC_SPELLCHECKER:
3036 if (lyxrc_orig.spellchecker != lyxrc_new.spellchecker)
3039 case LyXRC::RC_SPELLCHECK_CONTINUOUSLY:
3040 case LyXRC::RC_SPELLCHECK_NOTES:
3041 case LyXRC::RC_SPLITINDEX_COMMAND:
3042 case LyXRC::RC_TEMPDIRPATH:
3043 case LyXRC::RC_TEMPLATEPATH:
3044 case LyXRC::RC_TEX_ALLOWS_SPACES:
3045 case LyXRC::RC_TEX_EXPECTS_WINDOWS_PATHS:
3046 if (lyxrc_orig.windows_style_tex_paths != lyxrc_new.windows_style_tex_paths) {
3047 os::windows_style_tex_paths(lyxrc_new.windows_style_tex_paths);
3050 case LyXRC::RC_TEXINPUTS_PREFIX:
3051 case LyXRC::RC_THESAURUSDIRPATH:
3052 case LyXRC::RC_UIFILE:
3053 case LyXRC::RC_USER_EMAIL:
3054 case LyXRC::RC_USER_INITIALS:
3055 case LyXRC::RC_USER_NAME:
3056 case LyXRC::RC_USE_CONVERTER_CACHE:
3057 case LyXRC::RC_USE_CONVERTER_NEEDAUTH_FORBIDDEN:
3058 case LyXRC::RC_USE_CONVERTER_NEEDAUTH:
3059 case LyXRC::RC_USE_NATIVE_FILEDIALOG:
3060 case LyXRC::RC_USE_SYSTEM_COLORS:
3061 case LyXRC::RC_USE_TOOLTIP:
3062 case LyXRC::RC_USE_SYSTEM_THEME_ICONS:
3063 case LyXRC::RC_VIEWDVI_PAPEROPTION:
3064 case LyXRC::RC_SINGLE_CLOSE_TAB_BUTTON:
3065 case LyXRC::RC_SINGLE_INSTANCE:
3066 case LyXRC::RC_SORT_LAYOUTS:
3067 case LyXRC::RC_FULL_SCREEN_LIMIT:
3068 case LyXRC::RC_FULL_SCREEN_SCROLLBAR:
3069 case LyXRC::RC_FULL_SCREEN_MENUBAR:
3070 case LyXRC::RC_FULL_SCREEN_STATUSBAR:
3071 case LyXRC::RC_FULL_SCREEN_TABBAR:
3072 case LyXRC::RC_FULL_SCREEN_TOOLBARS:
3073 case LyXRC::RC_FULL_SCREEN_WIDTH:
3074 case LyXRC::RC_VISUAL_CURSOR:
3075 case LyXRC::RC_CLOSE_BUFFER_WITH_LAST_VIEW:
3076 case LyXRC::RC_VIEWER:
3077 case LyXRC::RC_VIEWER_ALTERNATIVES:
3078 case LyXRC::RC_FORWARD_SEARCH_DVI:
3079 case LyXRC::RC_FORWARD_SEARCH_PDF:
3080 case LyXRC::RC_EXPORT_OVERWRITE:
3081 case LyXRC::RC_DEFAULT_DECIMAL_SEP:
3082 case LyXRC::RC_DEFAULT_LENGTH_UNIT:
3083 case LyXRC::RC_SCROLL_WHEEL_ZOOM:
3084 case LyXRC::RC_CURSOR_WIDTH:
3090 set<string> LyXRC::getRCs()
3093 for (int i = 0; i != lyxrcCount; ++i)
3094 res.insert(ltrim(lyxrcTags[i].tag, "\\"));
3100 string const LyXRC::getDescription(LyXRCTags tag)
3105 case RC_ACCEPT_COMPOUND:
3106 str = _("Consider run-together words, such as \"diskdrive\" for \"disk drive\", as legal words?");
3110 str = _("Specify an alternate language. The default is to use the language of the document.");
3113 case RC_PLAINTEXT_LINELEN:
3114 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.");
3117 case RC_AUTOREGIONDELETE:
3118 str = _("De-select if you don't want the current selection to be replaced automatically by what you type.");
3121 case RC_AUTORESET_OPTIONS:
3122 str = _("De-select if you don't want the class options to be reset to defaults after class change.");
3126 str = _("The time interval between auto-saves (in seconds). 0 means no auto-save.");
3129 case RC_AUTO_NUMBER:
3132 case RC_BACKUPDIR_PATH:
3133 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.");
3136 case RC_BIBTEX_COMMAND:
3137 str = _("Define the options of bibtex (cf. man bibtex) or select an alternative compiler (e.g. mlbibtex or bibulus).");
3140 case RC_JBIBTEX_COMMAND:
3141 str = _("Define the options of the bibtex program for PLaTeX (Japanese LaTeX).");
3145 str = _("Keybindings file. Can either specify an absolute path, or LyX will look in its global and local bind/ directories.");
3148 case RC_CHECKLASTFILES:
3149 str = _("Select to check whether the lastfiles still exist.");
3152 case RC_CHKTEX_COMMAND:
3153 str = _("Define how to run chktex. E.g. \"chktex -n11 -n1 -n3 -n6 -n9 -22 -n25 -n30 -n38\" Refer to the ChkTeX documentation.");
3159 case RC_CONVERTER_NEEDAUTH_FORBIDDEN:
3160 str = _("Forbid use of external converters with 'needauth' option to prevent undesired effects.");
3163 case RC_CONVERTER_NEEDAUTH:
3164 str = _("Ask user before calling external converters with 'needauth' option to prevent undesired effects.");
3170 case RC_CURSOR_FOLLOWS_SCROLLBAR:
3171 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.");
3174 case RC_CURSOR_WIDTH:
3175 str = _("Configure the width of the text cursor. Automatic zoom-controlled cursor width used when set to 0.");
3178 case RC_SCROLL_BELOW_DOCUMENT:
3179 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");
3182 case RC_MAC_DONTSWAP_CTRL_META:
3183 str = _("Make Apple key act as Meta and Control key as Ctrl.");
3186 case RC_MAC_LIKE_CURSOR_MOVEMENT:
3187 str = _("Use the Mac OS X conventions for cursor movement");
3190 case RC_SHOW_MACRO_LABEL:
3191 str = _("Show a small box around a Math Macro with the macro name when the cursor is inside.");
3195 str = _("Command definition file. Can either specify an absolute path, or LyX will look in its global and local commands/ directories.");
3198 case RC_DEFAULT_OTF_VIEW_FORMAT:
3199 str = _("The default format used with LFUN_BUFFER_[VIEW|UPDATE] with non-TeX fonts.");
3202 case RC_DEFAULT_VIEW_FORMAT:
3203 str = _("The default format used with LFUN_BUFFER_[VIEW|UPDATE].");
3206 case RC_DIALOGS_ICONIFY_WITH_MAIN:
3207 str = _("Iconify the dialogs when the main window is iconified. (Affects only dialogs shown after the change has been made.)");
3210 case RC_DISPLAY_GRAPHICS:
3211 str = _("Select how LyX will display any graphics.");
3214 case RC_DOCUMENTPATH:
3215 str = _("The default path for your documents. An empty value selects the directory LyX was started from.");
3219 str = _("Specify additional chars that can be part of a word.");
3222 case RC_EXAMPLEPATH:
3223 str = _("The path that LyX will set when offering to choose an example. An empty value selects the directory LyX was started from.");
3229 case RC_INDEX_COMMAND:
3230 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\".");
3233 case RC_JINDEX_COMMAND:
3234 str = _("Define the options of the index program for PLaTeX (Japanese LaTeX).");
3237 case RC_NOMENCL_COMMAND:
3238 str = _("Define the options of makeindex (cf. man makeindex) to be used for nomenclatures. This might differ from the index processing options.");
3241 case RC_PYGMENTIZE_COMMAND:
3242 str = _("The command to run the python pygments syntax highlighter.");
3249 case RC_KBMAP_PRIMARY:
3250 case RC_KBMAP_SECONDARY:
3251 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.");
3254 case RC_LANGUAGE_AUTO_BEGIN:
3255 str = _("Select if a language switching command is needed at the beginning of the document.");
3258 case RC_LANGUAGE_AUTO_END:
3259 str = _("Select if a language switching command is needed at the end of the document.");
3262 case RC_LANGUAGE_COMMAND_BEGIN:
3263 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.");
3266 case RC_LANGUAGE_COMMAND_END:
3267 str = _("The LaTeX command for changing back to the language of the document.");
3270 case RC_LANGUAGE_COMMAND_LOCAL:
3271 str = _("The LaTeX command for local changing of the language.");
3274 case RC_LANGUAGE_GLOBAL_OPTIONS:
3275 str = _("De-select if you don't want the language(s) used as an argument to \\documentclass.");
3278 case RC_LANGUAGE_CUSTOM_PACKAGE:
3279 str = _("The LaTeX command for loading the language package. E.g. \"\\usepackage{babel}\", \"\\usepackage{omega}\".");
3282 case RC_LANGUAGE_PACKAGE_SELECTION:
3283 str = _("De-select if you don't want babel to be used when the language of the document is the default language.");
3286 case RC_USELASTFILEPOS:
3287 str = _("De-select if you do not want LyX to scroll to saved position.");
3290 case RC_LOADSESSION:
3291 str = _("De-select to prevent loading files opened from the last LyX session.");
3294 case RC_MAKE_BACKUP:
3295 str = _("De-select if you don't want LyX to create backup files.");
3298 case RC_MARK_FOREIGN_LANGUAGE:
3299 str = _("Select to control the highlighting of words with a language foreign to that of the document.");
3302 case RC_RESPECT_OS_KBD_LANGUAGE:
3303 str = _("Select to use the current keyboard language, as set from the operating system, as default input language.");
3306 case RC_MOUSE_WHEEL_SPEED:
3307 str = _("The scrolling speed of the mouse wheel.");
3310 case RC_COMPLETION_POPUP_DELAY:
3311 str = _("The completion popup delay.");
3314 case RC_COMPLETION_POPUP_MATH:
3315 str = _("Select to display the completion popup in math mode.");
3318 case RC_COMPLETION_POPUP_TEXT:
3319 str = _("Select to display the completion popup in text mode.");
3322 case RC_COMPLETION_POPUP_AFTER_COMPLETE:
3323 str = _("Show the completion popup without delay after non-unique completion attempt.");
3326 case RC_COMPLETION_POPUP_TEXT:
3327 str = _("Show a small triangle on the cursor to indicate that a completion is available.");
3330 case RC_COMPLETION_POPUP_DELAY:
3331 str = _("The inline completion delay.");
3334 case RC_COMPLETION_INLINE_MATH:
3335 str = _("Select to display the inline completion in math mode.");
3338 case RC_COMPLETION_INLINE_TEXT:
3339 str = _("Select to display the inline completion in text mode.");
3342 case RC_COMPLETION_INLINE_DOTS:
3343 str = _("Use \"...\" to shorten long completions.");
3346 case RC_AUTOCORRECTION_MATH:
3347 str = _("Allow TeXMacs shorthand, like => converting to \\Rightarrow.");
3350 case RC_NUMLASTFILES:
3351 str = bformat(_("Maximal number of lastfiles. Up to %1$d can appear in the file menu."),
3355 case RC_PATH_PREFIX:
3356 str = _("Specify those directories which should be "
3357 "prepended to the PATH environment variable.\n"
3358 "Use the OS native format.");
3362 str = _("Shows a typeset preview of things such as math");
3365 case RC_PREVIEW_HASHED_LABELS:
3366 str = _("Previewed equations will have \"(#)\" labels rather than numbered ones");
3369 case RC_PREVIEW_SCALE_FACTOR:
3370 str = _("Scale the preview size to suit.");
3373 case RC_PRINTLANDSCAPEFLAG:
3374 str = _("The option to print out in landscape.");
3377 case RC_PRINTPAPERDIMENSIONFLAG:
3378 str = _("Option to specify the dimensions of the print paper.");
3381 case RC_PRINTPAPERFLAG:
3382 str = _("The option to specify paper type.");
3385 case RC_VISUAL_CURSOR:
3386 str = _("Select to have visual bidi cursor movement, unselect for logical movement.");
3389 case RC_CLOSE_BUFFER_WITH_LAST_VIEW:
3390 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).");
3394 str = _("DPI (dots per inch) of your monitor is auto-detected by LyX. If that goes wrong, override the setting here.");
3397 case RC_SCREEN_FONT_ROMAN:
3398 case RC_SCREEN_FONT_SANS:
3399 case RC_SCREEN_FONT_TYPEWRITER:
3400 str = _("The screen fonts used to display the text while editing.");
3403 case RC_SCREEN_FONT_ROMAN_FOUNDRY:
3404 case RC_SCREEN_FONT_SANS_FOUNDRY:
3405 case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
3408 case RC_SCREEN_FONT_SCALABLE:
3409 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.");
3412 case RC_SCREEN_FONT_SIZES:
3413 str = _("The font sizes used for calculating the scaling of the screen fonts.");
3416 case RC_SCREEN_ZOOM:
3417 //xgettext:no-c-format
3418 str = _("The zoom percentage for screen fonts. A setting of 100% will make the fonts roughly the same size as on paper.");
3421 case RC_GEOMETRY_SESSION:
3422 str = _("Allow session manager to save and restore windows geometry.");
3426 str = _("This starts the lyxserver. The pipes get an additional extension \".in\" and \".out\". Only for advanced users.");
3432 case RC_SHOW_BANNER:
3433 str = _("De-select if you don't want the startup banner.");
3436 case RC_TEMPDIRPATH:
3437 str = _("LyX will place its temporary directories in this path. They will be deleted when you quit LyX.");
3440 case RC_THESAURUSDIRPATH:
3441 str = _("This is the place where the files of the thesaurus library reside.");
3444 case RC_TEMPLATEPATH:
3445 str = _("The path that LyX will set when offering to choose a template. An empty value selects the directory LyX was started from.");
3448 case RC_TEX_ALLOWS_SPACES:
3451 case RC_TEX_EXPECTS_WINDOWS_PATHS:
3454 case RC_TEXINPUTS_PREFIX:
3455 str = _("Specify those directories which should be "
3456 "prepended to the TEXINPUTS environment variable.\n"
3457 "A '.' represents the current document directory. "
3458 "Use the OS native format.");
3462 str = _("The UI (user interface) file. Can either specify an absolute path, or LyX will look in its global and local ui/ directories.");
3471 case RC_USE_USE_SYSTEM_COLORS:
3472 str = _("Enable use the system colors for some things like main window background and selection.");
3475 case RC_USE_TOOLTIP:
3476 str = _("Enable the automatic appearance of tool tips in the work area.");
3479 case RC_VIEWDVI_PAPEROPTION:
3480 _("Specify the paper command to DVI viewer (leave empty or use \"-paper\")");
3495 // The global instance
3498 // The global copy of the system lyxrc entries (everything except preferences)