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"
30 #include "SpellChecker.h"
33 #include "graphics/GraphicsTypes.h"
35 #include "support/convert.h"
36 #include "support/debug.h"
37 #include "support/environment.h"
38 #include "support/FileName.h"
39 #include "support/filetools.h"
40 #include "support/gettext.h"
41 #include "support/lstrings.h"
42 #include "support/os.h"
43 #include "support/Package.h"
44 #include "support/TempFile.h"
45 #include "support/userinfo.h"
52 using namespace lyx::support;
56 namespace os = support::os;
60 // The format should also be updated in configure.py, and conversion code
61 // should be added to prefs2prefs_prefs.py.
62 static unsigned int const LYXRC_FILEFORMAT = 29; // spitz: remove \\date_insert_format
63 // when adding something to this array keep it sorted!
64 LexerKeyword lyxrcTags[] = {
65 { "\\accept_compound", LyXRC::RC_ACCEPT_COMPOUND },
66 { "\\allow_geometry_session", LyXRC::RC_GEOMETRY_SESSION },
67 { "\\alternate_language", LyXRC::RC_ALT_LANG },
68 { "\\auto_number", LyXRC::RC_AUTO_NUMBER },
69 { "\\auto_region_delete", LyXRC::RC_AUTOREGIONDELETE },
70 { "\\auto_reset_options", LyXRC::RC_AUTORESET_OPTIONS },
71 { "\\autocorrection_math", LyXRC::RC_AUTOCORRECTION_MATH },
72 { "\\autosave", LyXRC::RC_AUTOSAVE },
73 { "\\backupdir_path", LyXRC::RC_BACKUPDIR_PATH },
74 { "\\bibtex_alternatives", LyXRC::RC_BIBTEX_ALTERNATIVES },
75 { "\\bibtex_command", LyXRC::RC_BIBTEX_COMMAND },
76 { "\\bind_file", LyXRC::RC_BINDFILE },
77 { "\\check_lastfiles", LyXRC::RC_CHECKLASTFILES },
78 { "\\chktex_command", LyXRC::RC_CHKTEX_COMMAND },
79 { "\\close_buffer_with_last_view", LyXRC::RC_CLOSE_BUFFER_WITH_LAST_VIEW },
80 { "\\completion_cursor_text", LyXRC::RC_COMPLETION_CURSOR_TEXT },
81 { "\\completion_inline_delay", LyXRC::RC_COMPLETION_INLINE_DELAY },
82 { "\\completion_inline_dots", LyXRC::RC_COMPLETION_INLINE_DOTS },
83 { "\\completion_inline_math", LyXRC::RC_COMPLETION_INLINE_MATH },
84 { "\\completion_inline_text", LyXRC::RC_COMPLETION_INLINE_TEXT },
85 { "\\completion_minlength", LyXRC::RC_COMPLETION_MINLENGTH },
86 { "\\completion_popup_after_complete", LyXRC::RC_COMPLETION_POPUP_AFTER_COMPLETE },
87 { "\\completion_popup_delay", LyXRC::RC_COMPLETION_POPUP_DELAY },
88 { "\\completion_popup_math", LyXRC::RC_COMPLETION_POPUP_MATH },
89 { "\\completion_popup_text", LyXRC::RC_COMPLETION_POPUP_TEXT },
90 { "\\converter", LyXRC::RC_CONVERTER },
91 { "\\converter_cache_maxage", LyXRC::RC_CONVERTER_CACHE_MAXAGE },
92 { "\\copier", LyXRC::RC_COPIER },
93 { "\\cursor_follows_scrollbar", LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR },
94 { "\\cursor_width", LyXRC::RC_CURSOR_WIDTH },
95 { "\\def_file", LyXRC::RC_DEFFILE },
96 { "\\default_decimal_point", LyXRC::RC_DEFAULT_DECIMAL_POINT },
97 { "\\default_length_unit", LyXRC::RC_DEFAULT_LENGTH_UNIT },
98 { "\\default_otf_view_format", LyXRC::RC_DEFAULT_OTF_VIEW_FORMAT },
99 { "\\default_platex_view_format", LyXRC::RC_DEFAULT_PLATEX_VIEW_FORMAT },
100 { "\\default_view_format", LyXRC::RC_DEFAULT_VIEW_FORMAT },
101 { "\\dialogs_iconify_with_main", LyXRC::RC_DIALOGS_ICONIFY_WITH_MAIN },
102 { "\\display_graphics", LyXRC::RC_DISPLAY_GRAPHICS },
103 { "\\document_path", LyXRC::RC_DOCUMENTPATH },
104 { "\\editor_alternatives", LyXRC::RC_EDITOR_ALTERNATIVES },
105 { "\\escape_chars", LyXRC::RC_ESC_CHARS },
106 { "\\example_path", LyXRC::RC_EXAMPLEPATH },
107 { "\\export_overwrite", LyXRC::RC_EXPORT_OVERWRITE },
108 { "\\format", LyXRC::RC_FILEFORMAT },
109 { "\\forward_search_dvi", LyXRC::RC_FORWARD_SEARCH_DVI },
110 { "\\forward_search_pdf", LyXRC::RC_FORWARD_SEARCH_PDF },
111 { "\\fullscreen_limit", LyXRC::RC_FULL_SCREEN_LIMIT },
112 { "\\fullscreen_menubar", LyXRC::RC_FULL_SCREEN_MENUBAR },
113 { "\\fullscreen_scrollbar", LyXRC::RC_FULL_SCREEN_SCROLLBAR },
114 { "\\fullscreen_statusbar", LyXRC::RC_FULL_SCREEN_STATUSBAR },
115 { "\\fullscreen_tabbar", LyXRC::RC_FULL_SCREEN_TABBAR },
116 { "\\fullscreen_toolbars", LyXRC::RC_FULL_SCREEN_TOOLBARS },
117 { "\\fullscreen_width", LyXRC::RC_FULL_SCREEN_WIDTH },
118 { "\\group_layouts", LyXRC::RC_GROUP_LAYOUTS },
119 { "\\gui_language", LyXRC::RC_GUI_LANGUAGE },
120 { "\\hunspelldir_path", LyXRC::RC_HUNSPELLDIR_PATH },
121 { "\\icon_set", LyXRC::RC_ICON_SET },
122 { "\\index_alternatives", LyXRC::RC_INDEX_ALTERNATIVES },
123 { "\\index_command", LyXRC::RC_INDEX_COMMAND },
124 { "\\input", LyXRC::RC_INPUT },
125 { "\\jbibtex_alternatives", LyXRC::RC_JBIBTEX_ALTERNATIVES },
126 { "\\jbibtex_command", LyXRC::RC_JBIBTEX_COMMAND },
127 { "\\jindex_command", LyXRC::RC_JINDEX_COMMAND },
128 { "\\kbmap", LyXRC::RC_KBMAP },
129 { "\\kbmap_primary", LyXRC::RC_KBMAP_PRIMARY },
130 { "\\kbmap_secondary", LyXRC::RC_KBMAP_SECONDARY },
131 { "\\language_auto_begin", LyXRC::RC_LANGUAGE_AUTO_BEGIN },
132 { "\\language_auto_end", LyXRC::RC_LANGUAGE_AUTO_END },
133 { "\\language_command_begin", LyXRC::RC_LANGUAGE_COMMAND_BEGIN },
134 { "\\language_command_end", LyXRC::RC_LANGUAGE_COMMAND_END },
135 { "\\language_command_local", LyXRC::RC_LANGUAGE_COMMAND_LOCAL },
136 { "\\language_custom_package", LyXRC::RC_LANGUAGE_CUSTOM_PACKAGE },
137 { "\\language_global_options", LyXRC::RC_LANGUAGE_GLOBAL_OPTIONS },
138 { "\\language_package_selection", LyXRC::RC_LANGUAGE_PACKAGE_SELECTION },
139 { "\\load_session", LyXRC::RC_LOADSESSION },
140 { "\\mac_dontswap_ctrl_meta", LyXRC::RC_MAC_DONTSWAP_CTRL_META },
141 { "\\mac_like_cursor_movement", LyXRC::RC_MAC_LIKE_CURSOR_MOVEMENT },
142 { "\\macro_edit_style", LyXRC::RC_MACRO_EDIT_STYLE },
143 { "\\make_backup", LyXRC::RC_MAKE_BACKUP },
144 { "\\mark_foreign_language", LyXRC::RC_MARK_FOREIGN_LANGUAGE },
145 { "\\mouse_middlebutton_paste", LyXRC::RC_MOUSE_MIDDLEBUTTON_PASTE },
146 { "\\mouse_wheel_speed", LyXRC::RC_MOUSE_WHEEL_SPEED },
147 { "\\nomencl_command", LyXRC::RC_NOMENCL_COMMAND },
148 { "\\num_lastfiles", LyXRC::RC_NUMLASTFILES },
149 { "\\open_buffers_in_tabs", LyXRC::RC_OPEN_BUFFERS_IN_TABS },
150 { "\\paragraph_markers", LyXRC::RC_PARAGRAPH_MARKERS },
151 { "\\path_prefix", LyXRC::RC_PATH_PREFIX },
152 { "\\plaintext_linelen", LyXRC::RC_PLAINTEXT_LINELEN },
153 { "\\preview", LyXRC::RC_PREVIEW },
154 { "\\preview_hashed_labels", LyXRC::RC_PREVIEW_HASHED_LABELS },
155 { "\\preview_scale_factor", LyXRC::RC_PREVIEW_SCALE_FACTOR },
156 { "\\print_landscape_flag", LyXRC::RC_PRINTLANDSCAPEFLAG },
157 { "\\print_paper_dimension_flag", LyXRC::RC_PRINTPAPERDIMENSIONFLAG },
158 { "\\print_paper_flag", LyXRC::RC_PRINTPAPERFLAG },
159 { "\\pygmentize_command", LyXRC::RC_PYGMENTIZE_COMMAND },
160 { "\\save_compressed", LyXRC::RC_SAVE_COMPRESSED },
161 { "\\save_origin", LyXRC::RC_SAVE_ORIGIN },
162 { "\\screen_dpi", LyXRC::RC_SCREEN_DPI },
163 { "\\screen_font_roman", LyXRC::RC_SCREEN_FONT_ROMAN },
164 { "\\screen_font_roman_foundry", LyXRC::RC_SCREEN_FONT_ROMAN_FOUNDRY },
165 { "\\screen_font_sans", LyXRC::RC_SCREEN_FONT_SANS },
166 { "\\screen_font_sans_foundry", LyXRC::RC_SCREEN_FONT_SANS_FOUNDRY },
167 { "\\screen_font_scalable", LyXRC::RC_SCREEN_FONT_SCALABLE },
168 { "\\screen_font_sizes", LyXRC::RC_SCREEN_FONT_SIZES },
169 { "\\screen_font_typewriter", LyXRC::RC_SCREEN_FONT_TYPEWRITER },
170 { "\\screen_font_typewriter_foundry", LyXRC::RC_SCREEN_FONT_TYPEWRITER_FOUNDRY },
171 { "\\screen_zoom", LyXRC::RC_SCREEN_ZOOM },
172 { "\\scroll_below_document", LyXRC::RC_SCROLL_BELOW_DOCUMENT },
173 { "\\scroll_wheel_zoom", LyXRC::RC_SCROLL_WHEEL_ZOOM },
174 { "\\serverpipe", LyXRC::RC_SERVERPIPE },
175 { "\\set_color", LyXRC::RC_SET_COLOR },
176 { "\\show_banner", LyXRC::RC_SHOW_BANNER },
177 { "\\single_close_tab_button", LyXRC::RC_SINGLE_CLOSE_TAB_BUTTON },
178 { "\\single_instance", LyXRC::RC_SINGLE_INSTANCE },
179 { "\\sort_layouts", LyXRC::RC_SORT_LAYOUTS },
180 { "\\spellcheck_continuously", LyXRC::RC_SPELLCHECK_CONTINUOUSLY },
181 { "\\spellcheck_notes", LyXRC::RC_SPELLCHECK_NOTES },
182 { "\\spellchecker", LyXRC::RC_SPELLCHECKER },
183 { "\\splitindex_command", LyXRC::RC_SPLITINDEX_COMMAND },
184 { "\\tempdir_path", LyXRC::RC_TEMPDIRPATH },
185 { "\\template_path", LyXRC::RC_TEMPLATEPATH },
186 { "\\tex_allows_spaces", LyXRC::RC_TEX_ALLOWS_SPACES },
187 { "\\tex_expects_windows_paths", LyXRC::RC_TEX_EXPECTS_WINDOWS_PATHS },
188 { "\\texinputs_prefix", LyXRC::RC_TEXINPUTS_PREFIX },
189 { "\\thesaurusdir_path", LyXRC::RC_THESAURUSDIRPATH },
190 { "\\ui_file", LyXRC::RC_UIFILE },
191 { "\\use_converter_cache", LyXRC::RC_USE_CONVERTER_CACHE },
192 { "\\use_converter_needauth", LyXRC::RC_USE_CONVERTER_NEEDAUTH },
193 { "\\use_converter_needauth_forbidden", LyXRC::RC_USE_CONVERTER_NEEDAUTH_FORBIDDEN },
194 { "\\use_lastfilepos", LyXRC::RC_USELASTFILEPOS },
195 { "\\use_native_filedialog", LyXRC::RC_USE_NATIVE_FILEDIALOG },
196 // compatibility with versions older than 1.4.0 only
197 { "\\use_system_colors", LyXRC::RC_USE_SYSTEM_COLORS },
198 { "\\use_system_theme_icons", LyXRC::RC_USE_SYSTEM_THEME_ICONS },
199 { "\\use_tooltip", LyXRC::RC_USE_TOOLTIP },
200 { "\\user_email", LyXRC::RC_USER_EMAIL },
201 { "\\user_name", LyXRC::RC_USER_NAME },
202 { "\\view_dvi_paper_option", LyXRC::RC_VIEWDVI_PAPEROPTION },
203 // compatibility with versions older than 1.4.0 only
204 { "\\viewer", LyXRC::RC_VIEWER},
205 { "\\viewer_alternatives", LyXRC::RC_VIEWER_ALTERNATIVES },
206 { "\\visual_cursor", LyXRC::RC_VISUAL_CURSOR },
207 { "format", LyXRC::RC_LYXRCFORMAT }
210 const int lyxrcCount = sizeof(lyxrcTags) / sizeof(lyxrcTags[0]);
221 void LyXRC::setDefaults()
224 use_system_theme_icons = false;
226 def_file = "default";
228 // The current document directory
229 texinputs_prefix = ".";
230 print_landscape_flag = "-t landscape";
231 print_paper_flag = "-t";
232 print_paper_dimension_flag = "-T";
233 document_path.erase();
234 view_dvi_paper_option.erase();
235 default_view_format = "pdf2";
236 default_otf_view_format = "pdf4";
237 default_platex_view_format = "pdf3";
238 chktex_command = "chktex -n1 -n3 -n6 -n9 -n22 -n25 -n30 -n38";
239 bibtex_command = "automatic";
240 index_command = "makeindex -c -q";
241 nomencl_command = "makeindex -s nomencl.ist";
242 pygmentize_command = string();
244 // Because a screen is typically wider than a piece of paper:
246 currentZoom = defaultZoom;
247 allow_geometry_session = true;
248 // Default LaTeX font size:
249 font_sizes[FONT_SIZE_TINY] = "5.0";
250 font_sizes[FONT_SIZE_SCRIPT] = "7.0";
251 font_sizes[FONT_SIZE_FOOTNOTE] = "8.0";
252 font_sizes[FONT_SIZE_SMALL] = "9.0";
253 font_sizes[FONT_SIZE_NORMAL] = "10.0";
254 font_sizes[FONT_SIZE_LARGE] = "12.0";
255 font_sizes[FONT_SIZE_LARGER] = "14.4";
256 font_sizes[FONT_SIZE_LARGEST] = "17.26";
257 font_sizes[FONT_SIZE_HUGE] = "20.74";
258 font_sizes[FONT_SIZE_HUGER] = "24.88";
259 use_scalable_fonts = true;
260 roman_font_name = "";
262 typewriter_font_name = "";
264 auto_region_delete = true;
265 auto_reset_options = false;
266 plaintext_linelen = 65;
267 mouse_wheel_speed = 1.0;
269 check_lastfiles = true;
270 use_lastfilepos = true;
271 use_native_filedialog = true;
272 load_session = false;
274 save_compressed = false;
276 backupdir_path.erase();
277 display_graphics = true;
278 // Spellchecker settings:
279 // FIXME: this check should test the target platform (darwin)
280 #if defined(USE_MACOSX_PACKAGING)
281 spellchecker = "native";
282 #elif defined(USE_ENCHANT)
283 spellchecker = "enchant";
284 #elif defined(USE_ASPELL)
285 spellchecker = "aspell";
286 #elif defined(USE_HUNSPELL)
287 spellchecker = "hunspell";
289 spellchecker = "aspell";
291 spellchecker_accept_compound = false;
292 spellcheck_continuously = false;
293 completion_minlength = 6;
294 spellcheck_notes = true;
296 visual_cursor = false;
298 mark_foreign_language = true;
299 language_auto_begin = true;
300 language_auto_end = true;
301 language_global_options = true;
302 language_package_selection = LP_AUTO;
303 language_custom_package = "\\usepackage{babel}";
304 language_command_begin = "\\selectlanguage{$$lang}";
305 language_command_local = "\\foreignlanguage{$$lang}{";
306 sort_layouts = false;
307 group_layouts = true;
308 gui_language = "auto";
310 windows_style_tex_paths = false;
311 tex_allows_spaces = false;
312 cursor_follows_scrollbar = false;
313 scroll_below_document = false;
314 scroll_wheel_zoom = SCROLL_WHEEL_ZOOM_CTRL;
315 paragraph_markers = false;
316 mac_dontswap_ctrl_meta = false;
317 mac_like_cursor_movement = false;
318 macro_edit_style = MACRO_EDIT_INLINE_BOX;
319 dialogs_iconify_with_main = false;
320 preview = PREVIEW_OFF;
321 preview_hashed_labels = false;
322 preview_scale_factor = 1.0;
323 use_converter_cache = true;
324 use_converter_needauth_forbidden = true;
325 use_converter_needauth = true;
326 use_system_colors = false;
328 converter_cache_maxage = 6 * 30 * 24 * 3600; // 6 months
329 user_name = to_utf8(support::user_name());
330 user_email = to_utf8(support::user_email());
331 open_buffers_in_tabs = true;
332 single_close_tab_button = false;
333 single_instance = true;
334 forward_search_dvi = string();
335 forward_search_pdf = string();
336 export_overwrite = NO_FILES;
338 // Fullscreen settings
339 full_screen_limit = false;
340 full_screen_toolbars = true;
341 full_screen_tabbar = true;
342 full_screen_menubar = true;
343 full_screen_statusbar = true;
344 full_screen_scrollbar = true;
345 full_screen_width = 700;
347 completion_cursor_text = true;
348 completion_popup_math = true;
349 completion_popup_text = false;
350 completion_popup_delay = 2.0;
351 completion_popup_after_complete = true;
352 autocorrection_math = false;
353 completion_inline_math = true;
354 completion_inline_text = false;
355 completion_inline_dots = -1;
356 completion_inline_delay = 0.2;
357 default_decimal_point = ".";
358 default_length_unit = Length::CM;
360 close_buffer_with_last_view = "yes";
361 mouse_middlebutton_paste = true;
367 void oldFontFormat(string & family, string & foundry)
369 if (family.empty() || family[0] != '-')
371 foundry = token(family, '-', 1);
372 family = token(family, '-', 2);
380 bool LyXRC::read(FileName const & filename, bool check_format)
382 Lexer lexrc(lyxrcTags);
383 lexrc.setFile(filename);
384 LYXERR(Debug::LYXRC, "Reading '" << filename << "'...");
385 ReturnValues retval = read(lexrc, check_format);
386 if (!check_format || retval != FormatMismatch)
387 return retval == ReadOK;
389 LYXERR(Debug::FILES, "Converting LyXRC file to " << LYXRC_FILEFORMAT);
390 TempFile tmp("convert_lyxrc");
391 FileName const tempfile = tmp.name();
392 bool const success = prefs2prefs(filename, tempfile, false);
394 LYXERR0 ("Unable to convert " << filename.absFileName() <<
395 " to format " << LYXRC_FILEFORMAT);
398 // Keep this in the else branch, such that lexrc2 goes out
399 // of scope and releases the lock on tempfile before we
400 // attempt to remove it. This matters on Windows.
401 Lexer lexrc2(lyxrcTags);
402 lexrc2.setFile(tempfile);
403 LYXERR(Debug::LYXRC, "Reading '" << tempfile << "'...");
404 retval = read(lexrc2, check_format);
405 if (retval == FormatMismatch)
406 LYXERR0("Conversion failed for " << filename.absFileName());
408 return retval == ReadOK;
412 // don't need to worry about conversion, because this is always
413 // from an internal source
414 bool LyXRC::read(istream & is)
416 Lexer lexrc(lyxrcTags);
418 LYXERR(Debug::LYXRC, "Reading istream...");
419 return read(lexrc, false) == ReadOK;
423 LyXRC::ReturnValues LyXRC::read(Lexer & lexrc, bool check_format)
425 if (lyxerr.debugging(Debug::PARSER))
426 lexrc.printTable(lyxerr);
431 // format prior to 2.0 and introduction of format tag
432 unsigned int rc_format = 0;
434 while (lexrc.isOK()) {
435 // By using two switches we take advantage of the compiler
436 // telling us if we have missed a LyXRCTags element in
437 // the second switch.
438 // Note that this also shows a problem with Lexer since it
439 // helps us avoid taking advantage of the strictness of the
442 int le = lexrc.lex();
444 case Lexer::LEX_UNDEF:
445 lexrc.printError("Unknown tag `$$Token'");
447 case Lexer::LEX_FEOF:
452 switch (static_cast<LyXRCTags>(le)) {
455 rc_format = lexrc.getInteger();
457 case RC_INPUT: // Include file
460 libFileSearch(string(),
462 if (!read(tmp, check_format)) {
464 "Error reading included file: " + tmp.absFileName());
470 bind_file = os::internal_path(lexrc.getString());
475 def_file = os::internal_path(lexrc.getString());
480 ui_file = os::internal_path(lexrc.getString());
483 case RC_AUTORESET_OPTIONS:
484 lexrc >> auto_reset_options;
487 case RC_DISPLAY_GRAPHICS:
489 display_graphics = lexrc.getString() == "true";
492 case RC_TEX_EXPECTS_WINDOWS_PATHS:
493 lexrc >> windows_style_tex_paths;
496 case RC_TEX_ALLOWS_SPACES:
497 lexrc >> tex_allows_spaces;
500 case RC_TEXINPUTS_PREFIX:
501 lexrc >> texinputs_prefix;
508 case RC_KBMAP_PRIMARY:
510 string const kmap(os::internal_path(lexrc.getString()));
511 if (!libFileSearch("kbd", kmap, "kmap").empty()
513 primary_kbmap = kmap;
515 lexrc.printError("LyX: Keymap `$$Token' not found");
520 case RC_KBMAP_SECONDARY:
522 string const kmap(os::internal_path(lexrc.getString()));
523 if (!libFileSearch("kbd", kmap, "kmap").empty()
525 secondary_kbmap = kmap;
527 lexrc.printError("LyX: Keymap `$$Token' not found");
532 case RC_PRINTLANDSCAPEFLAG:
533 lexrc >> print_landscape_flag;
536 case RC_PRINTPAPERDIMENSIONFLAG:
537 lexrc >> print_paper_dimension_flag;
540 case RC_PRINTPAPERFLAG:
541 lexrc >> print_paper_flag;
544 case RC_PYGMENTIZE_COMMAND:
545 if (lexrc.next(true)) {
546 pygmentize_command = lexrc.getString();
550 case RC_VIEWDVI_PAPEROPTION:
552 view_dvi_paper_option = lexrc.getString();
554 view_dvi_paper_option.erase();
557 case RC_CHKTEX_COMMAND:
558 if (lexrc.next(true)) {
559 chktex_command = lexrc.getString();
563 case RC_BIBTEX_ALTERNATIVES:
564 if (lexrc.next(true)) {
565 bibtex_alternatives.insert(lexrc.getString());
569 case RC_BIBTEX_COMMAND:
570 if (lexrc.next(true)) {
571 bibtex_command = lexrc.getString();
575 case RC_JBIBTEX_COMMAND:
576 if (lexrc.next(true)) {
577 jbibtex_command = lexrc.getString();
581 case RC_JBIBTEX_ALTERNATIVES:
582 if (lexrc.next(true)) {
583 jbibtex_alternatives.insert(lexrc.getString());
587 case RC_INDEX_ALTERNATIVES:
588 if (lexrc.next(true)) {
589 index_alternatives.insert(lexrc.getString());
593 case RC_INDEX_COMMAND:
594 if (lexrc.next(true)) {
595 index_command = lexrc.getString();
599 case RC_JINDEX_COMMAND:
600 if (lexrc.next(true)) {
601 jindex_command = lexrc.getString();
605 case RC_SPLITINDEX_COMMAND:
606 if (lexrc.next(true)) {
607 splitindex_command = lexrc.getString();
611 case RC_NOMENCL_COMMAND:
612 if (lexrc.next(true)) {
613 nomencl_command = lexrc.getString();
622 lexrc >> defaultZoom;
623 if (defaultZoom < 10)
627 case RC_GEOMETRY_SESSION:
628 lexrc >> allow_geometry_session;
631 case RC_SCREEN_FONT_SIZES:
632 lexrc >> font_sizes[FONT_SIZE_TINY];
633 lexrc >> font_sizes[FONT_SIZE_SCRIPT];
634 lexrc >> font_sizes[FONT_SIZE_FOOTNOTE];
635 lexrc >> font_sizes[FONT_SIZE_SMALL];
636 lexrc >> font_sizes[FONT_SIZE_NORMAL];
637 lexrc >> font_sizes[FONT_SIZE_LARGE];
638 lexrc >> font_sizes[FONT_SIZE_LARGER];
639 lexrc >> font_sizes[FONT_SIZE_LARGEST];
640 lexrc >> font_sizes[FONT_SIZE_HUGE];
641 lexrc >> font_sizes[FONT_SIZE_HUGER];
644 case RC_SCREEN_FONT_SCALABLE:
645 lexrc >> use_scalable_fonts;
652 case RC_DOCUMENTPATH:
654 document_path = os::internal_path(lexrc.getString());
659 example_path = os::internal_path(lexrc.getString());
662 case RC_TEMPLATEPATH:
664 template_path = os::internal_path(lexrc.getString());
669 tempdir_path = os::internal_path(lexrc.getString());
672 case RC_THESAURUSDIRPATH:
674 thesaurusdir_path = os::internal_path(lexrc.getString());
677 case RC_HUNSPELLDIR_PATH:
679 hunspelldir_path = os::internal_path(lexrc.getString());
682 case RC_USELASTFILEPOS:
683 lexrc >> use_lastfilepos;
687 lexrc >> load_session;
690 case RC_MOUSE_WHEEL_SPEED:
691 lexrc >> mouse_wheel_speed;
694 case RC_COMPLETION_INLINE_DELAY:
695 lexrc >> completion_inline_delay;
698 case RC_COMPLETION_INLINE_MATH:
699 lexrc >> completion_inline_math;
702 case RC_COMPLETION_INLINE_TEXT:
703 lexrc >> completion_inline_text;
706 case RC_COMPLETION_INLINE_DOTS:
707 lexrc >> completion_inline_dots;
710 case RC_AUTOCORRECTION_MATH:
711 lexrc >> autocorrection_math;
714 case RC_COMPLETION_POPUP_DELAY:
715 lexrc >> completion_popup_delay;
718 case RC_COMPLETION_POPUP_MATH:
719 lexrc >> completion_popup_math;
722 case RC_COMPLETION_POPUP_TEXT:
723 lexrc >> completion_popup_text;
726 case RC_COMPLETION_CURSOR_TEXT:
727 lexrc >> completion_cursor_text;
730 case RC_COMPLETION_POPUP_AFTER_COMPLETE:
731 lexrc >> completion_popup_after_complete;
734 case RC_COMPLETION_MINLENGTH:
735 lexrc >> completion_minlength;
738 case RC_NUMLASTFILES:
739 lexrc >> num_lastfiles;
742 case RC_CHECKLASTFILES:
743 lexrc >> check_lastfiles;
750 case RC_USE_SYSTEM_THEME_ICONS:
751 lexrc >> use_system_theme_icons;
754 case RC_SCREEN_FONT_ROMAN:
756 roman_font_name = lexrc.getString();
757 oldFontFormat(roman_font_name,
762 case RC_SCREEN_FONT_SANS:
764 sans_font_name = lexrc.getString();
765 oldFontFormat(sans_font_name, sans_font_foundry);
769 case RC_SCREEN_FONT_TYPEWRITER:
771 typewriter_font_name = lexrc.getString();
772 oldFontFormat(typewriter_font_name,
773 typewriter_font_foundry);
777 case RC_SCREEN_FONT_ROMAN_FOUNDRY:
778 lexrc >> roman_font_foundry;
781 case RC_SCREEN_FONT_SANS_FOUNDRY:
782 lexrc >> sans_font_foundry;
785 case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
786 lexrc >> typewriter_font_foundry;
791 lexrc.printError("Missing color tag.");
794 string lyx_name = lexrc.getString();
797 lexrc.printError("Missing color name for color: `$$Token'");
800 string x11_name = lexrc.getString();
802 ColorCode const col =
803 lcolor.getFromLyXName(lyx_name);
804 if (col == Color_none ||
805 col == Color_inherit ||
809 if (!lcolor.setColor(col, x11_name))
810 LYXERR0("Bad lyxrc set_color for " << lyx_name);
814 case RC_AUTOREGIONDELETE:
815 // Auto region delete defaults to true
816 lexrc >> auto_region_delete;
821 lyxpipes = os::internal_path(lexrc.getString());
824 case RC_CURSOR_FOLLOWS_SCROLLBAR:
825 lexrc >> cursor_follows_scrollbar;
828 case RC_CURSOR_WIDTH:
829 lexrc >> cursor_width;
832 case RC_SCROLL_BELOW_DOCUMENT:
833 lexrc >> scroll_below_document;
836 case RC_PARAGRAPH_MARKERS:
837 lexrc >> paragraph_markers;
840 case RC_MAC_DONTSWAP_CTRL_META:
841 lexrc >> mac_dontswap_ctrl_meta;
844 case RC_MAC_LIKE_CURSOR_MOVEMENT:
845 lexrc >> mac_like_cursor_movement;
848 case RC_MACRO_EDIT_STYLE:
850 switch (lexrc.getInteger()) {
851 case 0: macro_edit_style = MACRO_EDIT_INLINE_BOX; break;
852 case 1: macro_edit_style = MACRO_EDIT_INLINE; break;
853 case 2: macro_edit_style = MACRO_EDIT_LIST; break;
858 case RC_DIALOGS_ICONIFY_WITH_MAIN:
859 lexrc >> dialogs_iconify_with_main;
862 case RC_PLAINTEXT_LINELEN:
863 lexrc >> plaintext_linelen;
865 // Spellchecker settings:
866 case RC_ACCEPT_COMPOUND:
867 lexrc >> spellchecker_accept_compound;
869 case RC_USE_NATIVE_FILEDIALOG:
870 lexrc >> use_native_filedialog;
872 case RC_USE_SYSTEM_COLORS:
873 lexrc >> use_system_colors;
876 lexrc >> use_tooltip;
878 case RC_SPELLCHECKER:
879 lexrc >> spellchecker;
882 lexrc >> spellchecker_alt_lang;
885 lexrc >> spellchecker_esc_chars;
887 case RC_SPELLCHECK_CONTINUOUSLY:
888 lexrc >> spellcheck_continuously;
890 case RC_SPELLCHECK_NOTES:
891 lexrc >> spellcheck_notes;
894 lexrc >> make_backup;
896 case RC_SAVE_COMPRESSED:
897 lexrc >> save_compressed;
900 lexrc >> save_origin;
902 case RC_BACKUPDIR_PATH:
904 backupdir_path = os::internal_path(lexrc.getString());
906 case RC_DEFAULT_DECIMAL_POINT:
907 lexrc >> default_decimal_point;
909 case RC_DEFAULT_LENGTH_UNIT:
911 default_length_unit = (Length::UNIT) lexrc.getInteger();
913 case RC_LANGUAGE_CUSTOM_PACKAGE:
914 lexrc >> language_custom_package;
916 case RC_LANGUAGE_AUTO_BEGIN:
917 lexrc >> language_auto_begin;
919 case RC_LANGUAGE_AUTO_END:
920 lexrc >> language_auto_end;
922 case RC_LANGUAGE_GLOBAL_OPTIONS:
923 lexrc >> language_global_options;
925 case RC_LANGUAGE_PACKAGE_SELECTION:
927 switch (lexrc.getInteger()) {
929 language_package_selection = LP_AUTO;
932 language_package_selection = LP_BABEL;
935 language_package_selection = LP_CUSTOM;
938 language_package_selection = LP_NONE;
943 case RC_LANGUAGE_COMMAND_BEGIN:
944 lexrc >> language_command_begin;
946 case RC_LANGUAGE_COMMAND_END:
947 lexrc >> language_command_end;
949 case RC_LANGUAGE_COMMAND_LOCAL:
950 lexrc >> language_command_local;
952 case RC_VISUAL_CURSOR:
953 lexrc >> visual_cursor;
955 case RC_CLOSE_BUFFER_WITH_LAST_VIEW:
956 lexrc >> close_buffer_with_last_view;
959 lexrc >> auto_number;
961 case RC_MARK_FOREIGN_LANGUAGE:
962 lexrc >> mark_foreign_language;
968 fmt = lexrc.getString();
969 if (lexrc.next(true))
970 command = lexrc.getString();
971 setMover(fmt, command);
976 string from, to, command, flags;
978 from = lexrc.getString();
980 to = lexrc.getString();
981 if (lexrc.next(true))
982 command = lexrc.getString();
984 flags = lexrc.getString();
986 theConverters().erase(from, to);
988 theConverters().add(from, to, command, flags);
991 // compatibility with versions older than 1.4.0 only
993 string format, command;
994 lexrc >> format >> command;
995 theFormats().setViewer(format, command);
998 case RC_FILEFORMAT: {
1000 string format, extensions, shortcut;
1001 docstring prettyname;
1002 if (!(lexrc >> format >> extensions))
1004 if (ok && lexrc.next(true))
1005 prettyname = lexrc.getDocString();
1009 if(!(lexrc >> shortcut))
1011 string viewer, editor;
1012 if (ok && lexrc.next(true))
1013 viewer = lexrc.getString();
1016 if (ok && lexrc.next(true))
1017 editor = lexrc.getString();
1021 if (!(lexrc >> flags >> mime))
1023 int flgs = Format::none;
1024 while (!flags.empty()) {
1026 flags = split(flags, flag, ',');
1027 if (flag == "document")
1028 flgs |= Format::document;
1029 else if (flag == "vector")
1030 flgs |= Format::vector;
1031 else if (flag == "zipped=native")
1032 flgs |= Format::zipped_native;
1033 else if (flag == "menu=export")
1034 flgs |= Format::export_menu;
1036 LYXERR0("Ignoring unknown flag `"
1037 << flag << "' for format `"
1041 LYXERR0("Syntax error in format " << format);
1042 else if (prettyname.empty()) {
1043 if (theConverters().formatIsUsed(format))
1044 LYXERR0("Can't delete format " << format);
1046 theFormats().erase(format);
1048 theFormats().add(format, extensions, prettyname,
1049 shortcut, viewer, editor, mime, flgs);
1053 case RC_VIEWER_ALTERNATIVES: {
1054 string format, command;
1055 if ((lexrc >> format) && lexrc.next(true)) {
1056 command = lexrc.getString();
1057 viewer_alternatives[format].insert(command);
1061 case RC_EDITOR_ALTERNATIVES: {
1062 string format, command;
1063 if ((lexrc >> format) && lexrc.next(true)) {
1064 command = lexrc.getString();
1065 editor_alternatives[format].insert(command);
1070 case RC_DEFAULT_OTF_VIEW_FORMAT:
1071 lexrc >> default_otf_view_format;
1074 case RC_DEFAULT_PLATEX_VIEW_FORMAT:
1075 lexrc >> default_platex_view_format;
1078 case RC_DEFAULT_VIEW_FORMAT:
1079 lexrc >> default_view_format;
1082 case RC_GUI_LANGUAGE:
1083 lexrc >> gui_language;
1086 case RC_SHOW_BANNER:
1087 lexrc >> show_banner;
1092 string const tmp = lexrc.getString();
1093 if (tmp == "true" || tmp == "on")
1094 preview = PREVIEW_ON;
1095 else if (tmp == "no_math")
1096 preview = PREVIEW_NO_MATH;
1098 preview = PREVIEW_OFF;
1099 if (tmp != "false" && tmp != "off")
1100 LYXERR0("Unrecognized preview status \""
1106 case RC_PREVIEW_HASHED_LABELS:
1107 lexrc >> preview_hashed_labels;
1110 case RC_PREVIEW_SCALE_FACTOR:
1111 lexrc >> preview_scale_factor;
1118 lexrc >> user_email;
1121 case RC_PATH_PREFIX:
1122 lexrc >> path_prefix;
1125 case RC_USE_CONVERTER_CACHE:
1126 lexrc >> use_converter_cache;
1128 case RC_USE_CONVERTER_NEEDAUTH_FORBIDDEN:
1129 lexrc >> use_converter_needauth_forbidden;
1131 case RC_USE_CONVERTER_NEEDAUTH:
1132 lexrc >> use_converter_needauth;
1134 case RC_CONVERTER_CACHE_MAXAGE:
1135 lexrc >> converter_cache_maxage;
1138 case RC_SORT_LAYOUTS:
1139 lexrc >> sort_layouts;
1141 case RC_GROUP_LAYOUTS:
1142 lexrc >> group_layouts;
1144 case RC_FULL_SCREEN_LIMIT:
1145 lexrc >> full_screen_limit;
1147 case RC_FULL_SCREEN_TOOLBARS:
1148 lexrc >> full_screen_toolbars;
1150 case RC_FULL_SCREEN_SCROLLBAR:
1151 lexrc >> full_screen_scrollbar;
1153 case RC_FULL_SCREEN_STATUSBAR:
1154 lexrc >> full_screen_statusbar;
1156 case RC_FULL_SCREEN_TABBAR:
1157 lexrc >> full_screen_tabbar;
1159 case RC_FULL_SCREEN_MENUBAR:
1160 lexrc >> full_screen_menubar;
1162 case RC_FULL_SCREEN_WIDTH:
1163 lexrc >> full_screen_width;
1165 case RC_OPEN_BUFFERS_IN_TABS:
1166 lexrc >> open_buffers_in_tabs;
1168 case RC_SINGLE_CLOSE_TAB_BUTTON:
1169 lexrc >> single_close_tab_button;
1171 case RC_SINGLE_INSTANCE:
1172 lexrc >> single_instance;
1173 if (run_mode == PREFERRED)
1174 run_mode = single_instance ? USE_REMOTE : NEW_INSTANCE;
1176 case RC_FORWARD_SEARCH_DVI:
1177 if (lexrc.next(true))
1178 forward_search_dvi = lexrc.getString();
1180 case RC_FORWARD_SEARCH_PDF:
1181 if (lexrc.next(true))
1182 forward_search_pdf = lexrc.getString();
1184 case RC_EXPORT_OVERWRITE:
1186 string const tmp = lexrc.getString();
1187 if (tmp == "all" || tmp == "true")
1188 export_overwrite = ALL_FILES;
1189 else if (tmp == "main")
1190 export_overwrite = MAIN_FILE;
1192 export_overwrite = NO_FILES;
1193 if (tmp != "ask" && tmp != "false")
1194 LYXERR0("Unrecognized export_overwrite status \""
1199 case RC_SCROLL_WHEEL_ZOOM:
1201 string const tmp = lexrc.getString();
1203 scroll_wheel_zoom = SCROLL_WHEEL_ZOOM_CTRL;
1204 else if (tmp == "shift")
1205 scroll_wheel_zoom = SCROLL_WHEEL_ZOOM_SHIFT;
1206 else if (tmp == "alt")
1207 scroll_wheel_zoom = SCROLL_WHEEL_ZOOM_ALT;
1209 scroll_wheel_zoom = SCROLL_WHEEL_ZOOM_OFF;
1210 if (tmp != "off" && tmp != "false")
1211 LYXERR0("Unrecognized scroll_wheel_zoom status \""
1217 case RC_MOUSE_MIDDLEBUTTON_PASTE:
1218 lexrc >> mouse_middlebutton_paste;
1222 break; // this is just a dummy
1225 // This is triggered the first time through the loop unless
1226 // we hit a format tag.
1227 if (check_format && rc_format != LYXRC_FILEFORMAT)
1228 return FormatMismatch;
1231 /// Update converters data-structures
1232 theConverters().update(theFormats());
1233 theConverters().buildGraph();
1234 theBufferList().invalidateConverterCache();
1240 void LyXRC::write(FileName const & filename, bool ignore_system_lyxrc) const
1242 ofstream ofs(filename.toFilesystemEncoding().c_str());
1244 write(ofs, ignore_system_lyxrc);
1248 void LyXRC::print() const
1250 if (lyxerr.debugging())
1251 write(lyxerr, false);
1259 typedef pair<string, SpecialisedMover> Data;
1261 SameMover(Data const & comparison)
1262 : comparison_(comparison) {}
1264 bool operator()(Data const & data) const
1266 return data.first == comparison_.first &&
1267 data.second.command() == comparison_.second.command();
1277 // Escape \ and " so that LyXLex can read the string later
1278 string escapeCommand(string const & str) {
1279 return subst(subst(str , "\\", "\\\\"),
1286 void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) const
1288 LyXRCTags tag = RC_LAST;
1290 if (!name.empty()) {
1291 for (int i = 0; i != lyxrcCount; ++i)
1292 if ("\\" + name == lyxrcTags[i].tag)
1293 tag = static_cast<LyXRCTags>(lyxrcTags[i].code);
1297 os << "# LyX " << lyx_version
1298 << " generated this file. If you want to make your own\n"
1299 << "# modifications you should do them from inside LyX and save.\n\n"
1300 << "Format " << LYXRC_FILEFORMAT << "\n\n";
1302 // Why the switch you might ask. It is a trick to ensure that all
1303 // the elements in the LyXRCTags enum are handled. As you can see
1304 // there are no breaks at all. So it is just a huge fall-through.
1305 // The nice thing is that we will get a warning from the compiler
1306 // if we forget an element.
1310 // input/include files are not done here
1311 case RC_LYXRCFORMAT:
1313 if (ignore_system_lyxrc ||
1314 bind_file != system_lyxrc.bind_file) {
1315 string const path = os::external_path(bind_file);
1316 os << "\\bind_file \"" << path << "\"\n";
1322 if (ignore_system_lyxrc ||
1323 def_file != system_lyxrc.def_file) {
1324 string const path = os::external_path(def_file);
1325 os << "\\def_file \"" << path << "\"\n";
1334 << "# MISC SECTION ######################################\n"
1336 // bind files are not done here.
1338 case RC_PATH_PREFIX:
1339 if (ignore_system_lyxrc ||
1340 path_prefix != system_lyxrc.path_prefix) {
1341 os << "\\path_prefix \"" << path_prefix << "\"\n";
1347 if (ignore_system_lyxrc ||
1348 ui_file != system_lyxrc.ui_file) {
1349 string const path = os::external_path(ui_file);
1350 os << "\\ui_file \"" << path << "\"\n";
1355 case RC_AUTOREGIONDELETE:
1356 if (ignore_system_lyxrc ||
1357 auto_region_delete != system_lyxrc.auto_region_delete) {
1358 os << "# Set to false to inhibit automatic replacement of\n"
1359 << "# the current selection.\n"
1360 << "\\auto_region_delete " << convert<string>(auto_region_delete)
1366 case RC_AUTORESET_OPTIONS:
1367 if (ignore_system_lyxrc ||
1368 auto_reset_options != system_lyxrc.auto_reset_options) {
1369 os << "# Set to false to inhibit automatic reset of\n"
1370 << "# the class options to defaults on class change.\n"
1371 << "\\auto_reset_options "
1372 << convert<string>(auto_reset_options)
1379 if (ignore_system_lyxrc ||
1380 autosave != system_lyxrc.autosave) {
1381 os << "# The time interval between auto-saves in seconds.\n"
1382 << "\\autosave " << autosave << '\n';
1387 case RC_DISPLAY_GRAPHICS:
1388 if (ignore_system_lyxrc ||
1389 display_graphics != system_lyxrc.display_graphics) {
1390 os << "# Display graphics within LyX\n"
1392 << "\\display_graphics "
1393 << (display_graphics ? "true" : "false")
1399 case RC_SORT_LAYOUTS:
1400 if (ignore_system_lyxrc ||
1401 sort_layouts != system_lyxrc.sort_layouts) {
1402 os << "# Sort layouts alphabetically.\n"
1403 << "\\sort_layouts " << convert<string>(sort_layouts) << '\n';
1408 case RC_GROUP_LAYOUTS:
1409 if (ignore_system_lyxrc ||
1410 group_layouts != system_lyxrc.group_layouts) {
1411 os << "# Group layouts by their category.\n"
1412 << "\\group_layouts " << convert<string>(group_layouts) << '\n';
1417 case RC_VIEWDVI_PAPEROPTION:
1418 if (ignore_system_lyxrc ||
1419 view_dvi_paper_option
1420 != system_lyxrc.view_dvi_paper_option) {
1421 os << "# Options used to specify paper size to the\n"
1422 << "# view_dvi_command (e.g. -paper)\n"
1423 << "\\view_dvi_paper_option \""
1424 << view_dvi_paper_option << "\"\n";
1429 case RC_CHKTEX_COMMAND:
1430 if (ignore_system_lyxrc ||
1431 chktex_command != system_lyxrc.chktex_command) {
1432 os << "\\chktex_command \"" << escapeCommand(chktex_command) << "\"\n";
1437 case RC_BIBTEX_ALTERNATIVES: {
1438 CommandSet::const_iterator it = bibtex_alternatives.begin();
1439 CommandSet::const_iterator end = bibtex_alternatives.end();
1440 for ( ; it != end; ++it) {
1441 if (ignore_system_lyxrc
1442 || !system_lyxrc.bibtex_alternatives.count(*it))
1443 os << "\\bibtex_alternatives \""
1450 case RC_BIBTEX_COMMAND:
1451 if (ignore_system_lyxrc ||
1452 bibtex_command != system_lyxrc.bibtex_command) {
1453 os << "\\bibtex_command \"" << escapeCommand(bibtex_command) << "\"\n";
1458 case RC_JBIBTEX_COMMAND:
1459 if (ignore_system_lyxrc ||
1460 jbibtex_command != system_lyxrc.jbibtex_command) {
1461 os << "\\jbibtex_command \"" << escapeCommand(jbibtex_command) << "\"\n";
1466 case RC_JBIBTEX_ALTERNATIVES: {
1467 CommandSet::const_iterator it = jbibtex_alternatives.begin();
1468 CommandSet::const_iterator end = jbibtex_alternatives.end();
1469 for ( ; it != end; ++it) {
1470 if (ignore_system_lyxrc
1471 || !system_lyxrc.jbibtex_alternatives.count(*it))
1472 os << "\\jbibtex_alternatives \""
1479 case RC_INDEX_ALTERNATIVES: {
1480 CommandSet::const_iterator it = index_alternatives.begin();
1481 CommandSet::const_iterator end = index_alternatives.end();
1482 for ( ; it != end; ++it) {
1483 if (ignore_system_lyxrc
1484 || !system_lyxrc.index_alternatives.count(*it))
1485 os << "\\index_alternatives \""
1492 case RC_INDEX_COMMAND:
1493 if (ignore_system_lyxrc ||
1494 index_command != system_lyxrc.index_command) {
1495 os << "\\index_command \"" << escapeCommand(index_command) << "\"\n";
1500 case RC_JINDEX_COMMAND:
1501 if (ignore_system_lyxrc ||
1502 jindex_command != system_lyxrc.jindex_command) {
1503 os << "\\jindex_command \"" << escapeCommand(jindex_command) << "\"\n";
1508 case RC_SPLITINDEX_COMMAND:
1509 if (ignore_system_lyxrc ||
1510 splitindex_command != system_lyxrc.splitindex_command) {
1511 os << "\\splitindex_command \"" << escapeCommand(splitindex_command) << "\"\n";
1516 case RC_NOMENCL_COMMAND:
1517 if (ignore_system_lyxrc ||
1518 nomencl_command != system_lyxrc.nomencl_command) {
1519 os << "\\nomencl_command \"" << escapeCommand(nomencl_command) << "\"\n";
1524 case RC_PYGMENTIZE_COMMAND:
1525 if (ignore_system_lyxrc ||
1526 pygmentize_command != system_lyxrc.pygmentize_command) {
1527 os << "\\pygmentize_command \"" << escapeCommand(pygmentize_command) << "\"\n";
1532 case RC_TEX_EXPECTS_WINDOWS_PATHS:
1533 // Don't write this setting to the preferences file,
1534 // but allow temporary changes (bug 7557).
1535 if (ignore_system_lyxrc) {
1536 os << "\\tex_expects_windows_paths "
1537 << convert<string>(windows_style_tex_paths) << '\n';
1542 case RC_TEX_ALLOWS_SPACES:
1543 if (tex_allows_spaces != system_lyxrc.tex_allows_spaces) {
1544 os << "\\tex_allows_spaces "
1545 << convert<string>(tex_allows_spaces) << '\n';
1551 if (ignore_system_lyxrc ||
1552 use_kbmap != system_lyxrc.use_kbmap) {
1553 os << "\\kbmap " << convert<string>(use_kbmap) << '\n';
1558 case RC_KBMAP_PRIMARY:
1559 if (ignore_system_lyxrc ||
1560 primary_kbmap != system_lyxrc.primary_kbmap) {
1561 string const path = os::external_path(primary_kbmap);
1562 os << "\\kbmap_primary \"" << path << "\"\n";
1567 case RC_KBMAP_SECONDARY:
1568 if (ignore_system_lyxrc ||
1569 secondary_kbmap != system_lyxrc.secondary_kbmap) {
1570 string const path = os::external_path(secondary_kbmap);
1571 os << "\\kbmap_secondary \"" << path << "\"\n";
1577 if (ignore_system_lyxrc ||
1578 lyxpipes != system_lyxrc.lyxpipes) {
1579 string const path = os::external_path(lyxpipes);
1580 os << "\\serverpipe \"" << path << "\"\n";
1586 os << "\\user_name \"" << user_name << "\"\n";
1591 os << "\\user_email \"" << user_email << "\"\n";
1595 case RC_SHOW_BANNER:
1596 if (ignore_system_lyxrc ||
1597 show_banner != system_lyxrc.show_banner) {
1598 os << "\\show_banner " << convert<string>(show_banner) << '\n';
1604 if (ignore_system_lyxrc ||
1605 preview != system_lyxrc.preview) {
1611 case PREVIEW_NO_MATH:
1618 os << "\\preview " << status << '\n';
1623 case RC_PREVIEW_HASHED_LABELS:
1624 if (ignore_system_lyxrc ||
1625 preview_hashed_labels !=
1626 system_lyxrc.preview_hashed_labels) {
1627 os << "\\preview_hashed_labels "
1628 << convert<string>(preview_hashed_labels) << '\n';
1633 case RC_PREVIEW_SCALE_FACTOR:
1634 if (ignore_system_lyxrc ||
1635 preview_scale_factor != system_lyxrc.preview_scale_factor) {
1636 os << "\\preview_scale_factor "
1637 << preview_scale_factor << '\n';
1642 case RC_USE_CONVERTER_CACHE:
1643 if (ignore_system_lyxrc ||
1644 use_converter_cache != system_lyxrc.use_converter_cache) {
1645 os << "\\use_converter_cache "
1646 << convert<string>(use_converter_cache) << '\n';
1651 case RC_USE_CONVERTER_NEEDAUTH_FORBIDDEN:
1652 if (ignore_system_lyxrc ||
1653 use_converter_needauth_forbidden != system_lyxrc.use_converter_needauth_forbidden) {
1654 os << "\\use_converter_needauth_forbidden "
1655 << convert<string>(use_converter_needauth_forbidden) << '\n';
1660 case RC_USE_CONVERTER_NEEDAUTH:
1661 if (ignore_system_lyxrc ||
1662 use_converter_needauth != system_lyxrc.use_converter_needauth) {
1663 os << "\\use_converter_needauth "
1664 << convert<string>(use_converter_needauth) << '\n';
1669 case RC_CONVERTER_CACHE_MAXAGE:
1670 if (ignore_system_lyxrc ||
1671 converter_cache_maxage != system_lyxrc.converter_cache_maxage) {
1672 os << "\\converter_cache_maxage "
1673 << converter_cache_maxage << '\n';
1679 << "# SCREEN & FONTS SECTION ############################\n"
1683 if (ignore_system_lyxrc ||
1684 icon_set != system_lyxrc.icon_set) {
1685 os << "\\icon_set \"" << icon_set
1691 case RC_USE_SYSTEM_THEME_ICONS:
1692 if (ignore_system_lyxrc ||
1693 use_system_theme_icons != system_lyxrc.use_system_theme_icons) {
1694 os << "\\use_system_theme_icons "
1695 << convert<string>(use_system_theme_icons)
1702 if (ignore_system_lyxrc ||
1703 dpi != system_lyxrc.dpi) {
1704 os << "\\screen_dpi " << dpi << '\n';
1709 case RC_SCREEN_ZOOM:
1710 if (ignore_system_lyxrc ||
1711 defaultZoom != system_lyxrc.defaultZoom) {
1712 os << "\\screen_zoom " << defaultZoom << '\n';
1717 case RC_GEOMETRY_SESSION:
1718 if (ignore_system_lyxrc ||
1719 allow_geometry_session != system_lyxrc.allow_geometry_session) {
1720 os << "\\allow_geometry_session " << convert<string>(allow_geometry_session)
1726 case RC_CURSOR_FOLLOWS_SCROLLBAR:
1727 if (ignore_system_lyxrc ||
1728 cursor_follows_scrollbar
1729 != system_lyxrc.cursor_follows_scrollbar) {
1730 os << "\\cursor_follows_scrollbar "
1731 << convert<string>(cursor_follows_scrollbar) << '\n';
1736 case RC_CURSOR_WIDTH:
1737 if (ignore_system_lyxrc ||
1739 != system_lyxrc.cursor_width) {
1740 os << "\\cursor_width "
1741 << cursor_width << '\n';
1746 case RC_SCROLL_BELOW_DOCUMENT:
1747 if (ignore_system_lyxrc ||
1748 scroll_below_document
1749 != system_lyxrc.scroll_below_document) {
1750 os << "\\scroll_below_document "
1751 << convert<string>(scroll_below_document) << '\n';
1756 case RC_PARAGRAPH_MARKERS:
1757 if (ignore_system_lyxrc ||
1759 != system_lyxrc.paragraph_markers) {
1760 os << "\\paragraph_markers "
1761 << convert<string>(paragraph_markers) << '\n';
1766 case RC_MAC_DONTSWAP_CTRL_META:
1767 if (ignore_system_lyxrc ||
1768 mac_dontswap_ctrl_meta
1769 != system_lyxrc.mac_dontswap_ctrl_meta) {
1770 os << "\\mac_dontswap_ctrl_meta "
1771 << convert<string>(mac_dontswap_ctrl_meta) << '\n';
1776 case RC_MAC_LIKE_CURSOR_MOVEMENT:
1777 if (ignore_system_lyxrc ||
1778 mac_like_cursor_movement
1779 != system_lyxrc.mac_like_cursor_movement) {
1780 os << "\\mac_like_cursor_movement "
1781 << convert<string>(mac_like_cursor_movement) << '\n';
1786 case RC_MACRO_EDIT_STYLE:
1787 if (ignore_system_lyxrc ||
1789 != system_lyxrc.macro_edit_style) {
1790 os << "\\macro_edit_style ";
1791 switch (macro_edit_style) {
1792 case MACRO_EDIT_INLINE_BOX: os << "0\n"; break;
1793 case MACRO_EDIT_INLINE: os << "1\n"; break;
1794 case MACRO_EDIT_LIST: os << "2\n"; break;
1800 case RC_DIALOGS_ICONIFY_WITH_MAIN:
1801 if (ignore_system_lyxrc ||
1802 dialogs_iconify_with_main
1803 != system_lyxrc.dialogs_iconify_with_main) {
1804 os << "\\dialogs_iconify_with_main "
1805 << convert<string>(dialogs_iconify_with_main) << '\n';
1810 case RC_SCREEN_FONT_ROMAN:
1811 if (ignore_system_lyxrc ||
1812 roman_font_name != system_lyxrc.roman_font_name) {
1813 os << "\\screen_font_roman \"" << roman_font_name
1819 case RC_SCREEN_FONT_ROMAN_FOUNDRY:
1820 if (ignore_system_lyxrc ||
1821 roman_font_foundry != system_lyxrc.roman_font_foundry) {
1822 os << "\\screen_font_roman_foundry \"" << roman_font_foundry
1828 case RC_SCREEN_FONT_SANS:
1829 if (ignore_system_lyxrc ||
1830 sans_font_name != system_lyxrc.sans_font_name) {
1831 os << "\\screen_font_sans \"" << sans_font_name
1837 case RC_SCREEN_FONT_SANS_FOUNDRY:
1838 if (ignore_system_lyxrc ||
1839 sans_font_foundry != system_lyxrc.sans_font_foundry) {
1840 os << "\\screen_font_sans_foundry \"" << sans_font_foundry
1846 case RC_SCREEN_FONT_TYPEWRITER:
1847 if (ignore_system_lyxrc ||
1848 typewriter_font_name != system_lyxrc.typewriter_font_name) {
1849 os << "\\screen_font_typewriter \""
1850 << typewriter_font_name << "\"\n";
1855 case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
1856 if (ignore_system_lyxrc ||
1857 typewriter_font_foundry != system_lyxrc.typewriter_font_foundry) {
1858 os << "\\screen_font_typewriter_foundry \""
1859 << typewriter_font_foundry << "\"\n";
1864 case RC_SCREEN_FONT_SCALABLE:
1865 if (ignore_system_lyxrc ||
1866 use_scalable_fonts != system_lyxrc.use_scalable_fonts) {
1867 os << "\\screen_font_scalable "
1868 << convert<string>(use_scalable_fonts)
1874 case RC_SCREEN_FONT_SIZES:
1875 if (ignore_system_lyxrc ||
1876 font_sizes[FONT_SIZE_TINY]
1877 != system_lyxrc.font_sizes[FONT_SIZE_TINY] ||
1878 font_sizes[FONT_SIZE_SCRIPT]
1879 != system_lyxrc.font_sizes[FONT_SIZE_SCRIPT] ||
1880 font_sizes[FONT_SIZE_FOOTNOTE]
1881 != system_lyxrc.font_sizes[FONT_SIZE_FOOTNOTE] ||
1882 font_sizes[FONT_SIZE_SMALL]
1883 != system_lyxrc.font_sizes[FONT_SIZE_SMALL] ||
1884 font_sizes[FONT_SIZE_NORMAL]
1885 != system_lyxrc.font_sizes[FONT_SIZE_NORMAL] ||
1886 font_sizes[FONT_SIZE_LARGE]
1887 != system_lyxrc.font_sizes[FONT_SIZE_LARGE] ||
1888 font_sizes[FONT_SIZE_LARGER]
1889 != system_lyxrc.font_sizes[FONT_SIZE_LARGER] ||
1890 font_sizes[FONT_SIZE_LARGEST]
1891 != system_lyxrc.font_sizes[FONT_SIZE_LARGEST] ||
1892 font_sizes[FONT_SIZE_HUGE]
1893 != system_lyxrc.font_sizes[FONT_SIZE_HUGE] ||
1894 font_sizes[FONT_SIZE_HUGER]
1895 != system_lyxrc.font_sizes[FONT_SIZE_HUGER]) {
1896 streamsize old_prec = os.precision();
1897 os.setf(ios::fixed);
1899 os << "\\screen_font_sizes"
1900 << ' ' << font_sizes[FONT_SIZE_TINY]
1901 << ' ' << font_sizes[FONT_SIZE_SCRIPT]
1902 << ' ' << font_sizes[FONT_SIZE_FOOTNOTE]
1903 << ' ' << font_sizes[FONT_SIZE_SMALL]
1904 << ' ' << font_sizes[FONT_SIZE_NORMAL]
1905 << ' ' << font_sizes[FONT_SIZE_LARGE]
1906 << ' ' << font_sizes[FONT_SIZE_LARGER]
1907 << ' ' << font_sizes[FONT_SIZE_LARGEST]
1908 << ' ' << font_sizes[FONT_SIZE_HUGE]
1909 << ' ' << font_sizes[FONT_SIZE_HUGER]
1911 os.precision(old_prec);
1912 os.unsetf(ios::fixed);
1917 case RC_FULL_SCREEN_LIMIT:
1918 if (ignore_system_lyxrc ||
1919 full_screen_limit != system_lyxrc.full_screen_limit) {
1920 os << "\\fullscreen_limit "
1921 << convert<string>(full_screen_limit)
1927 case RC_FULL_SCREEN_TOOLBARS:
1928 if (ignore_system_lyxrc ||
1929 full_screen_toolbars != system_lyxrc.full_screen_toolbars) {
1930 os << "\\fullscreen_toolbars "
1931 << convert<string>(full_screen_toolbars)
1937 case RC_FULL_SCREEN_SCROLLBAR:
1938 if (ignore_system_lyxrc ||
1939 full_screen_scrollbar != system_lyxrc.full_screen_scrollbar) {
1940 os << "\\fullscreen_scrollbar "
1941 << convert<string>(full_screen_scrollbar)
1947 case RC_FULL_SCREEN_STATUSBAR:
1948 if (ignore_system_lyxrc ||
1949 full_screen_statusbar != system_lyxrc.full_screen_statusbar) {
1950 os << "\\fullscreen_statusbar "
1951 << convert<string>(full_screen_statusbar)
1957 case RC_FULL_SCREEN_TABBAR:
1958 if (ignore_system_lyxrc ||
1959 full_screen_tabbar != system_lyxrc.full_screen_tabbar) {
1960 os << "\\fullscreen_tabbar "
1961 << convert<string>(full_screen_tabbar)
1967 case RC_FULL_SCREEN_MENUBAR:
1968 if (ignore_system_lyxrc ||
1969 full_screen_menubar != system_lyxrc.full_screen_menubar) {
1970 os << "\\fullscreen_menubar "
1971 << convert<string>(full_screen_menubar)
1977 case RC_FULL_SCREEN_WIDTH:
1978 if (ignore_system_lyxrc ||
1979 full_screen_width != system_lyxrc.full_screen_width) {
1980 os << "\\fullscreen_width "
1981 << convert<string>(full_screen_width)
1987 case RC_OPEN_BUFFERS_IN_TABS:
1988 if (ignore_system_lyxrc ||
1989 open_buffers_in_tabs != system_lyxrc.open_buffers_in_tabs) {
1990 os << "\\open_buffers_in_tabs "
1991 << convert<string>(open_buffers_in_tabs)
1997 case RC_SINGLE_CLOSE_TAB_BUTTON:
1998 if (ignore_system_lyxrc ||
1999 single_close_tab_button != system_lyxrc.single_close_tab_button) {
2000 os << "\\single_close_tab_button "
2001 << convert<string>(single_close_tab_button)
2007 case RC_SINGLE_INSTANCE:
2008 if (ignore_system_lyxrc ||
2009 single_instance != system_lyxrc.single_instance) {
2010 os << "\\single_instance "
2011 << convert<string>(single_instance)
2017 case RC_FORWARD_SEARCH_DVI:
2018 if (ignore_system_lyxrc ||
2019 forward_search_dvi != system_lyxrc.forward_search_dvi) {
2020 os << "\\forward_search_dvi \"" << escapeCommand(forward_search_dvi) << "\"\n";
2025 case RC_FORWARD_SEARCH_PDF:
2026 if (ignore_system_lyxrc ||
2027 forward_search_pdf != system_lyxrc.forward_search_pdf) {
2028 os << "\\forward_search_pdf \"" << escapeCommand(forward_search_pdf) << "\"\n";
2034 << "# COLOR SECTION ###################################\n"
2039 for (int i = 0; i < Color_ignore; ++i) {
2040 ColorCode lc = static_cast<ColorCode>(i);
2041 string const col = lcolor.getX11Name(lc);
2042 if (ignore_system_lyxrc
2043 || col != system_lcolor.getX11Name(lc)) {
2044 os << "\\set_color \""
2045 << lcolor.getLyXName(lc) << "\" \""
2053 << "# PRINTER SECTION ###################################\n"
2057 case RC_PRINTLANDSCAPEFLAG:
2058 if (ignore_system_lyxrc ||
2059 print_landscape_flag != system_lyxrc.print_landscape_flag) {
2060 os << "\\print_landscape_flag \"" << print_landscape_flag
2066 case RC_PRINTPAPERFLAG:
2067 if (ignore_system_lyxrc ||
2068 print_paper_flag != system_lyxrc.print_paper_flag) {
2069 os << "\\print_paper_flag \"" << print_paper_flag
2075 case RC_PRINTPAPERDIMENSIONFLAG:
2076 if (ignore_system_lyxrc ||
2077 print_paper_dimension_flag
2078 != system_lyxrc.print_paper_dimension_flag) {
2079 os << "\\print_paper_dimension_flag \""
2080 << print_paper_dimension_flag << "\"\n";
2086 << "# TEX SECTION #######################################\n"
2090 case RC_TEXINPUTS_PREFIX:
2091 if (ignore_system_lyxrc ||
2092 texinputs_prefix != system_lyxrc.texinputs_prefix) {
2093 os << "\\texinputs_prefix \"" << texinputs_prefix << "\"\n";
2099 << "# FILE SECTION ######################################\n"
2102 case RC_DOCUMENTPATH:
2103 if (ignore_system_lyxrc ||
2104 document_path != system_lyxrc.document_path) {
2105 string const path = os::external_path(document_path);
2106 os << "\\document_path \"" << path << "\"\n";
2111 case RC_USELASTFILEPOS:
2112 if (ignore_system_lyxrc ||
2113 use_lastfilepos != system_lyxrc.use_lastfilepos) {
2114 os << "\\use_lastfilepos " << convert<string>(use_lastfilepos)
2120 case RC_LOADSESSION:
2121 if (ignore_system_lyxrc ||
2122 load_session != system_lyxrc.load_session) {
2123 os << "\\load_session " << convert<string>(load_session)
2129 case RC_MOUSE_WHEEL_SPEED:
2130 if (ignore_system_lyxrc ||
2131 mouse_wheel_speed != system_lyxrc.mouse_wheel_speed) {
2132 os << "\\mouse_wheel_speed " << mouse_wheel_speed << '\n';
2137 case RC_MOUSE_MIDDLEBUTTON_PASTE:
2138 if (ignore_system_lyxrc ||
2139 mouse_middlebutton_paste != system_lyxrc.mouse_middlebutton_paste) {
2140 os << "\\mouse_middlebutton_paste "
2141 << convert<string>(mouse_middlebutton_paste) << '\n';
2146 case RC_COMPLETION_INLINE_DELAY:
2147 if (ignore_system_lyxrc ||
2148 completion_inline_delay != system_lyxrc.completion_inline_delay) {
2149 os << "\\completion_inline_delay " << completion_inline_delay << '\n';
2154 case RC_COMPLETION_INLINE_MATH:
2155 if (ignore_system_lyxrc ||
2156 completion_inline_math != system_lyxrc.completion_inline_math) {
2157 os << "\\completion_inline_math "
2158 << convert<string>(completion_inline_math) << '\n';
2163 case RC_COMPLETION_INLINE_TEXT:
2164 if (ignore_system_lyxrc ||
2165 completion_inline_text != system_lyxrc.completion_inline_text) {
2166 os << "\\completion_inline_text "
2167 << convert<string>(completion_inline_text) << '\n';
2172 case RC_COMPLETION_INLINE_DOTS:
2173 if (ignore_system_lyxrc ||
2174 completion_inline_dots != system_lyxrc.completion_inline_dots) {
2175 os << "\\completion_inline_dots "
2176 << convert<string>(completion_inline_dots) << '\n';
2181 case RC_AUTOCORRECTION_MATH:
2182 if (ignore_system_lyxrc ||
2183 autocorrection_math != system_lyxrc.autocorrection_math) {
2184 os << "\\autocorrection_math "
2185 << convert<string>(autocorrection_math) << '\n';
2190 case RC_COMPLETION_POPUP_DELAY:
2191 if (ignore_system_lyxrc ||
2192 completion_popup_delay != system_lyxrc.completion_popup_delay) {
2193 os << "\\completion_popup_delay " << completion_popup_delay << '\n';
2198 case RC_COMPLETION_POPUP_MATH:
2199 if (ignore_system_lyxrc ||
2200 completion_popup_math != system_lyxrc.completion_popup_math) {
2201 os << "\\completion_popup_math "
2202 << convert<string>(completion_popup_math) << '\n';
2207 case RC_COMPLETION_POPUP_TEXT:
2208 if (ignore_system_lyxrc ||
2209 completion_popup_text != system_lyxrc.completion_popup_text) {
2210 os << "\\completion_popup_text "
2211 << convert<string>(completion_popup_text) << '\n';
2216 case RC_COMPLETION_CURSOR_TEXT:
2217 if (ignore_system_lyxrc ||
2218 completion_cursor_text != system_lyxrc.completion_cursor_text) {
2219 os << "\\completion_cursor_text "
2220 << convert<string>(completion_cursor_text) << '\n';
2225 case RC_COMPLETION_POPUP_AFTER_COMPLETE:
2226 if (ignore_system_lyxrc ||
2227 completion_popup_after_complete
2228 != system_lyxrc.completion_popup_after_complete) {
2229 os << "\\completion_popup_after_complete "
2230 << convert<string>(completion_popup_after_complete) << '\n';
2235 case RC_COMPLETION_MINLENGTH:
2236 if (ignore_system_lyxrc ||
2237 completion_minlength != system_lyxrc.completion_minlength) {
2238 os << "\\completion_minlength " << convert<string>(completion_minlength)
2244 case RC_NUMLASTFILES:
2245 if (ignore_system_lyxrc ||
2246 num_lastfiles != system_lyxrc.num_lastfiles) {
2247 os << "\\num_lastfiles " << num_lastfiles << '\n';
2252 case RC_CHECKLASTFILES:
2253 if (ignore_system_lyxrc ||
2254 check_lastfiles != system_lyxrc.check_lastfiles) {
2255 os << "\\check_lastfiles " << convert<string>(check_lastfiles)
2261 case RC_EXAMPLEPATH:
2262 if (ignore_system_lyxrc ||
2263 example_path != system_lyxrc.example_path) {
2264 string const path = os::external_path(example_path);
2265 os << "\\example_path \"" << path << "\"\n";
2270 case RC_TEMPLATEPATH:
2271 if (ignore_system_lyxrc ||
2272 template_path != system_lyxrc.template_path) {
2273 string const path = os::external_path(template_path);
2274 os << "\\template_path \"" << path << "\"\n";
2279 case RC_TEMPDIRPATH:
2280 if (ignore_system_lyxrc ||
2281 tempdir_path != system_lyxrc.tempdir_path) {
2282 string const path = os::external_path(tempdir_path);
2283 os << "\\tempdir_path \"" << path << "\"\n";
2288 case RC_THESAURUSDIRPATH:
2289 if (ignore_system_lyxrc ||
2290 thesaurusdir_path != system_lyxrc.thesaurusdir_path) {
2291 string const path = os::external_path(thesaurusdir_path);
2292 os << "\\thesaurusdir_path \"" << path << "\"\n";
2297 case RC_HUNSPELLDIR_PATH:
2298 if (ignore_system_lyxrc ||
2299 hunspelldir_path != system_lyxrc.hunspelldir_path) {
2300 string const path = os::external_path(hunspelldir_path);
2301 os << "\\hunspelldir_path \"" << path << "\"\n";
2306 case RC_PLAINTEXT_LINELEN:
2307 if (ignore_system_lyxrc ||
2308 plaintext_linelen != system_lyxrc.plaintext_linelen) {
2309 os << "\\plaintext_linelen " << plaintext_linelen << '\n';
2314 case RC_MAKE_BACKUP:
2315 if (ignore_system_lyxrc ||
2316 make_backup != system_lyxrc.make_backup) {
2317 os << "\\make_backup " << convert<string>(make_backup) << '\n';
2322 case RC_SAVE_COMPRESSED:
2323 if (ignore_system_lyxrc ||
2324 save_compressed != system_lyxrc.save_compressed) {
2325 os << "\\save_compressed " << convert<string>(save_compressed) << '\n';
2330 case RC_SAVE_ORIGIN:
2331 if (ignore_system_lyxrc ||
2332 save_origin != system_lyxrc.save_origin) {
2333 os << "\\save_origin " << convert<string>(save_origin) << '\n';
2338 case RC_BACKUPDIR_PATH:
2339 if (ignore_system_lyxrc ||
2340 backupdir_path != system_lyxrc.backupdir_path) {
2341 string const path = os::external_path(backupdir_path);
2342 os << "\\backupdir_path \"" << path << "\"\n";
2348 << "# PLAIN TEXT EXPORT SECTION ##############################\n"
2352 << "# SPELLCHECKER SECTION ##############################\n"
2356 case RC_ACCEPT_COMPOUND:
2357 if (ignore_system_lyxrc ||
2358 spellchecker_accept_compound != system_lyxrc.spellchecker_accept_compound) {
2359 os << "\\accept_compound " << convert<string>(spellchecker_accept_compound)
2366 if (ignore_system_lyxrc ||
2367 spellchecker_alt_lang != system_lyxrc.spellchecker_alt_lang) {
2368 os << "\\alternate_language \"" << spellchecker_alt_lang
2375 if (ignore_system_lyxrc ||
2376 spellchecker_esc_chars != system_lyxrc.spellchecker_esc_chars) {
2377 os << "\\escape_chars \"" << spellchecker_esc_chars << "\"\n";
2382 case RC_USE_NATIVE_FILEDIALOG:
2383 if (ignore_system_lyxrc ||
2384 use_native_filedialog != system_lyxrc.use_native_filedialog) {
2385 os << "\\use_native_filedialog "
2386 << convert<string>(use_native_filedialog)
2392 case RC_USE_SYSTEM_COLORS:
2393 if (ignore_system_lyxrc ||
2394 use_system_colors != system_lyxrc.use_system_colors) {
2395 os << "\\use_system_colors "
2396 << convert<string>(use_system_colors)
2402 case RC_USE_TOOLTIP:
2403 if (ignore_system_lyxrc ||
2404 use_tooltip != system_lyxrc.use_tooltip) {
2405 os << "\\use_tooltip "
2406 << convert<string>(use_tooltip)
2414 << "# LANGUAGE SUPPORT SECTION ##########################\n"
2418 case RC_DEFAULT_DECIMAL_POINT:
2419 if (ignore_system_lyxrc ||
2420 default_decimal_point != system_lyxrc.default_decimal_point) {
2421 os << "\\default_decimal_point " << default_decimal_point << '\n';
2426 case RC_DEFAULT_LENGTH_UNIT:
2427 if (ignore_system_lyxrc ||
2428 default_length_unit != system_lyxrc.default_length_unit) {
2429 os << "\\default_length_unit " << int(default_length_unit) << '\n';
2434 case RC_SPELLCHECKER:
2435 if (ignore_system_lyxrc ||
2436 spellchecker != system_lyxrc.spellchecker) {
2437 os << "\\spellchecker " << spellchecker << '\n';
2442 case RC_SPELLCHECK_CONTINUOUSLY:
2443 if (ignore_system_lyxrc ||
2444 spellcheck_continuously != system_lyxrc.spellcheck_continuously) {
2445 os << "\\spellcheck_continuously " << convert<string>(spellcheck_continuously)
2451 case RC_SPELLCHECK_NOTES:
2452 if (ignore_system_lyxrc ||
2453 spellcheck_notes != system_lyxrc.spellcheck_notes) {
2454 os << "\\spellcheck_notes " << convert<string>(spellcheck_notes)
2460 case RC_VISUAL_CURSOR:
2461 if (ignore_system_lyxrc ||
2462 visual_cursor != system_lyxrc.visual_cursor) {
2463 os << "\\visual_cursor " << convert<string>(visual_cursor) << '\n';
2468 case RC_CLOSE_BUFFER_WITH_LAST_VIEW:
2469 if (ignore_system_lyxrc ||
2470 close_buffer_with_last_view != system_lyxrc.close_buffer_with_last_view) {
2471 os << "# When closing last view, buffer closes (yes), hides (no), or ask the user (ask)\n";
2472 os << "\\close_buffer_with_last_view " << close_buffer_with_last_view << '\n';
2477 case RC_LANGUAGE_CUSTOM_PACKAGE:
2478 if (ignore_system_lyxrc ||
2479 language_custom_package != system_lyxrc.language_custom_package) {
2480 os << "\\language_custom_package \"" << language_custom_package
2486 case RC_LANGUAGE_GLOBAL_OPTIONS:
2487 if (ignore_system_lyxrc ||
2488 language_global_options
2489 != system_lyxrc.language_global_options) {
2490 os << "\\language_global_options \""
2491 << convert<string>(language_global_options)
2497 case RC_LANGUAGE_PACKAGE_SELECTION:
2498 if (ignore_system_lyxrc ||
2499 language_package_selection != system_lyxrc.language_package_selection) {
2500 os << "\\language_package_selection ";
2501 switch (language_package_selection) {
2519 case RC_LANGUAGE_COMMAND_BEGIN:
2520 if (ignore_system_lyxrc ||
2521 language_command_begin
2522 != system_lyxrc.language_command_begin) {
2523 os << "\\language_command_begin \""
2524 << language_command_begin
2530 case RC_LANGUAGE_COMMAND_END:
2531 if (ignore_system_lyxrc ||
2532 language_command_end
2533 != system_lyxrc.language_command_end) {
2534 os << "\\language_command_end \"" << language_command_end
2540 case RC_LANGUAGE_COMMAND_LOCAL:
2541 if (ignore_system_lyxrc ||
2542 language_command_local
2543 != system_lyxrc.language_command_local) {
2544 os << "\\language_command_local \""
2545 << language_command_local
2551 case RC_LANGUAGE_AUTO_BEGIN:
2552 if (ignore_system_lyxrc ||
2553 language_auto_begin != system_lyxrc.language_auto_begin) {
2554 os << "\\language_auto_begin "
2555 << convert<string>(language_auto_begin) << '\n';
2560 case RC_LANGUAGE_AUTO_END:
2561 if (ignore_system_lyxrc ||
2562 language_auto_end != system_lyxrc.language_auto_end) {
2563 os << "\\language_auto_end "
2564 << convert<string>(language_auto_end) << '\n';
2569 case RC_MARK_FOREIGN_LANGUAGE:
2570 if (ignore_system_lyxrc ||
2571 mark_foreign_language
2572 != system_lyxrc.mark_foreign_language) {
2573 os << "\\mark_foreign_language " <<
2574 convert<string>(mark_foreign_language) << '\n';
2580 << "# 2nd MISC SUPPORT SECTION ##########################\n"
2584 case RC_AUTO_NUMBER:
2585 if (ignore_system_lyxrc ||
2586 auto_number != system_lyxrc.auto_number) {
2587 os << "\\auto_number " << convert<string>(auto_number) << '\n';
2592 case RC_GUI_LANGUAGE:
2593 if (ignore_system_lyxrc ||
2594 gui_language != system_lyxrc.gui_language) {
2595 os << "\\gui_language " << gui_language << '\n';
2600 case RC_EXPORT_OVERWRITE:
2601 if (ignore_system_lyxrc ||
2602 export_overwrite != system_lyxrc.export_overwrite) {
2604 switch (export_overwrite) {
2615 os << "\\export_overwrite " << status << '\n';
2620 case RC_SCROLL_WHEEL_ZOOM:
2621 if (ignore_system_lyxrc ||
2622 scroll_wheel_zoom != system_lyxrc.scroll_wheel_zoom) {
2624 switch (scroll_wheel_zoom) {
2625 case SCROLL_WHEEL_ZOOM_OFF:
2628 case SCROLL_WHEEL_ZOOM_CTRL:
2631 case SCROLL_WHEEL_ZOOM_SHIFT:
2634 case SCROLL_WHEEL_ZOOM_ALT:
2638 os << "\\scroll_wheel_zoom " << status << '\n';
2644 << "# FORMATS SECTION ##########################\n"
2649 // New/modified formats
2650 for (Formats::const_iterator cit = theFormats().begin();
2651 cit != theFormats().end(); ++cit) {
2652 Format const * format =
2653 theSystemFormats().getFormat(cit->name());
2655 format->extensions() != cit->extensions() ||
2656 format->prettyname() != cit->prettyname() ||
2657 format->shortcut() != cit->shortcut() ||
2658 format->viewer() != cit->viewer() ||
2659 format->editor() != cit->editor() ||
2660 format->documentFormat() != cit->documentFormat() ||
2661 format->vectorFormat() != cit->vectorFormat() ||
2662 format->inExportMenu() != cit->inExportMenu() ||
2663 format->mime() != cit->mime()) {
2664 os << "\\format \"" << cit->name() << "\" \""
2665 << cit->extensions() << "\" \""
2666 << to_utf8(cit->prettyname()) << "\" \""
2667 << cit->shortcut() << "\" \""
2668 << escapeCommand(cit->viewer()) << "\" \""
2669 << escapeCommand(cit->editor()) << "\" \"";
2670 vector<string> flags;
2671 if (cit->documentFormat())
2672 flags.push_back("document");
2673 if (cit->vectorFormat())
2674 flags.push_back("vector");
2675 if (cit->zippedNative())
2676 flags.push_back("zipped=native");
2677 if (cit->inExportMenu())
2678 flags.push_back("menu=export");
2680 os << getStringFromVector(flags);
2681 os << "\" \"" << cit->mime() << "\"\n";
2685 // Look for deleted formats
2686 for (Formats::const_iterator cit = theSystemFormats().begin();
2687 cit != theSystemFormats().end(); ++cit)
2688 if (!theFormats().getFormat(cit->name()))
2689 os << "\\format \"" << cit->name()
2690 << "\" \"\" \"\" \"\" \"\" \"\" \"\" \"\"\n";
2694 case RC_VIEWER_ALTERNATIVES: {
2695 Alternatives::const_iterator it = viewer_alternatives.begin();
2696 Alternatives::const_iterator const en = viewer_alternatives.end();
2697 Alternatives::const_iterator const sysend =
2698 system_lyxrc.viewer_alternatives.end();
2699 for (; it != en; ++it) {
2700 string const & fmt = it->first;
2701 CommandSet const & cmd = it->second;
2702 CommandSet::const_iterator sit = cmd.begin();
2703 CommandSet::const_iterator const sen = cmd.end();
2704 Alternatives::const_iterator const sysfmt = ignore_system_lyxrc ?
2705 system_lyxrc.viewer_alternatives.begin() : // we won't use it in this case
2706 system_lyxrc.viewer_alternatives.find(fmt);
2707 for (; sit != sen; ++sit) {
2708 string const & cmd = *sit;
2709 if (ignore_system_lyxrc
2710 || sysfmt == sysend // format not found
2711 || sysfmt->second.count(cmd) == 0 // this command not found
2713 os << "\\viewer_alternatives " << fmt << " \"" << escapeCommand(cmd) << "\"\n";
2720 case RC_EDITOR_ALTERNATIVES: {
2721 Alternatives::const_iterator it = editor_alternatives.begin();
2722 Alternatives::const_iterator const en = editor_alternatives.end();
2723 Alternatives::const_iterator const sysend =
2724 system_lyxrc.editor_alternatives.end();
2725 for (; it != en; ++it) {
2726 string const & fmt = it->first;
2727 CommandSet const & cmd = it->second;
2728 CommandSet::const_iterator sit = cmd.begin();
2729 CommandSet::const_iterator const sen = cmd.end();
2730 Alternatives::const_iterator const sysfmt = ignore_system_lyxrc ?
2731 system_lyxrc.editor_alternatives.begin() : // we won't use it in this case
2732 system_lyxrc.editor_alternatives.find(fmt);
2733 for (; sit != sen; ++sit) {
2734 string const & cmd = *sit;
2735 if (ignore_system_lyxrc
2736 || sysfmt == sysend // format not found
2737 || sysfmt->second.count(cmd) == 0 // this command not found
2739 os << "\\editor_alternatives " << fmt << " \"" << escapeCommand(cmd) << "\"\n";
2746 case RC_DEFAULT_OTF_VIEW_FORMAT:
2747 if ((ignore_system_lyxrc ||
2748 default_otf_view_format != system_lyxrc.default_otf_view_format)
2749 && !default_otf_view_format.empty()) {
2750 os << "\\default_otf_view_format " << default_otf_view_format << '\n';
2755 case RC_DEFAULT_PLATEX_VIEW_FORMAT:
2756 if ((ignore_system_lyxrc ||
2757 default_platex_view_format != system_lyxrc.default_platex_view_format)
2758 && !default_platex_view_format.empty()) {
2759 os << "\\default_platex_view_format " << default_platex_view_format << '\n';
2764 case RC_DEFAULT_VIEW_FORMAT:
2765 if (ignore_system_lyxrc ||
2766 default_view_format != system_lyxrc.default_view_format) {
2767 os << "\\default_view_format " << default_view_format << '\n';
2778 << "# CONVERTERS SECTION ##########################\n"
2783 // Look for new converters
2784 for (Converters::const_iterator cit = theConverters().begin();
2785 cit != theConverters().end(); ++cit) {
2786 Converter const * converter =
2787 theSystemConverters().getConverter(cit->from(),
2790 converter->command() != cit->command() ||
2791 converter->flags() != cit->flags())
2792 os << "\\converter \"" << cit->from() << "\" \""
2793 << cit->to() << "\" \""
2794 << escapeCommand(cit->command()) << "\" \""
2795 << cit->flags() << "\"\n";
2798 // New/modifed converters
2799 for (Converters::const_iterator cit = theSystemConverters().begin();
2800 cit != theSystemConverters().end(); ++cit)
2801 if (!theConverters().getConverter(cit->from(), cit->to()))
2802 os << "\\converter \"" << cit->from()
2803 << "\" \"" << cit->to() << "\" \"\" \"\"\n";
2810 << "# COPIERS SECTION ##########################\n"
2813 // Look for new movers
2814 Movers::const_iterator const sysbegin = theSystemMovers().begin();
2815 Movers::const_iterator const sysend = theSystemMovers().end();
2816 Movers::const_iterator it = theMovers().begin();
2817 Movers::const_iterator end = theMovers().end();
2819 for (; it != end; ++it) {
2820 Movers::const_iterator const sysit =
2821 find_if(sysbegin, sysend, SameMover(*it));
2822 if (sysit == sysend) {
2823 string const & fmt = it->first;
2824 string const & command =
2825 it->second.command();
2827 os << "\\copier " << fmt
2828 << " \"" << escapeCommand(command) << "\"\n";
2834 // We don't actually delete SpecialisedMover(s) from the
2835 // map, just clear their 'command', so there's no need
2836 // to test for anything else.
2843 void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new)
2845 // Why the switch you might ask. It is a trick to ensure that all
2846 // the elements in the LyXRCTags enum is handled. As you can see
2847 // there are no breaks at all. So it is just a huge fall-through.
2848 // The nice thing is that we will get a warning from the compiler
2849 // if we forget an element.
2850 LyXRC::LyXRCTags tag = LyXRC::RC_LAST;
2852 case LyXRC::RC_LAST:
2853 case LyXRC::RC_ACCEPT_COMPOUND:
2854 if (lyxrc_orig.spellchecker_accept_compound != lyxrc_new.spellchecker_accept_compound)
2855 if (theSpellChecker()) theSpellChecker()->advanceChangeNumber();
2857 case LyXRC::RC_ALT_LANG:
2858 case LyXRC::RC_PLAINTEXT_LINELEN:
2859 case LyXRC::RC_AUTOCORRECTION_MATH:
2860 case LyXRC::RC_AUTOREGIONDELETE:
2861 case LyXRC::RC_AUTORESET_OPTIONS:
2862 case LyXRC::RC_AUTOSAVE:
2863 case LyXRC::RC_AUTO_NUMBER:
2864 case LyXRC::RC_BACKUPDIR_PATH:
2865 case LyXRC::RC_BIBTEX_ALTERNATIVES:
2866 case LyXRC::RC_BIBTEX_COMMAND:
2867 case LyXRC::RC_BINDFILE:
2868 case LyXRC::RC_CHECKLASTFILES:
2869 case LyXRC::RC_COMPLETION_CURSOR_TEXT:
2870 case LyXRC::RC_COMPLETION_INLINE_DELAY:
2871 case LyXRC::RC_COMPLETION_INLINE_DOTS:
2872 case LyXRC::RC_COMPLETION_INLINE_MATH:
2873 case LyXRC::RC_COMPLETION_INLINE_TEXT:
2874 case LyXRC::RC_COMPLETION_POPUP_AFTER_COMPLETE:
2875 case LyXRC::RC_COMPLETION_POPUP_DELAY:
2876 case LyXRC::RC_COMPLETION_POPUP_MATH:
2877 case LyXRC::RC_COMPLETION_POPUP_TEXT:
2878 case LyXRC::RC_COMPLETION_MINLENGTH:
2879 case LyXRC::RC_USELASTFILEPOS:
2880 case LyXRC::RC_LOADSESSION:
2881 case LyXRC::RC_CHKTEX_COMMAND:
2882 case LyXRC::RC_CONVERTER:
2883 case LyXRC::RC_CONVERTER_CACHE_MAXAGE:
2884 case LyXRC::RC_COPIER:
2885 case LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR:
2886 case LyXRC::RC_SCROLL_BELOW_DOCUMENT:
2887 case LyXRC::RC_GUI_LANGUAGE:
2888 case LyXRC::RC_DEFAULT_OTF_VIEW_FORMAT:
2889 case LyXRC::RC_DEFAULT_PLATEX_VIEW_FORMAT:
2890 case LyXRC::RC_DEFAULT_VIEW_FORMAT:
2891 case LyXRC::RC_DEFFILE:
2892 case LyXRC::RC_DIALOGS_ICONIFY_WITH_MAIN:
2893 case LyXRC::RC_DISPLAY_GRAPHICS:
2894 case LyXRC::RC_DOCUMENTPATH:
2895 if (lyxrc_orig.document_path != lyxrc_new.document_path) {
2896 FileName path(lyxrc_new.document_path);
2897 if (path.exists() && path.isDirectory())
2898 package().document_dir() = FileName(lyxrc.document_path);
2901 case LyXRC::RC_EDITOR_ALTERNATIVES:
2902 case LyXRC::RC_ESC_CHARS:
2903 case LyXRC::RC_EXAMPLEPATH:
2904 case LyXRC::RC_FILEFORMAT:
2905 case LyXRC::RC_GROUP_LAYOUTS:
2906 case LyXRC::RC_HUNSPELLDIR_PATH:
2907 case LyXRC::RC_ICON_SET:
2908 case LyXRC::RC_INDEX_ALTERNATIVES:
2909 case LyXRC::RC_INDEX_COMMAND:
2910 case LyXRC::RC_JBIBTEX_COMMAND:
2911 case LyXRC::RC_JBIBTEX_ALTERNATIVES:
2912 case LyXRC::RC_JINDEX_COMMAND:
2913 case LyXRC::RC_NOMENCL_COMMAND:
2914 case LyXRC::RC_PYGMENTIZE_COMMAND:
2915 case LyXRC::RC_INPUT:
2916 case LyXRC::RC_KBMAP:
2917 case LyXRC::RC_KBMAP_PRIMARY:
2918 case LyXRC::RC_KBMAP_SECONDARY:
2919 case LyXRC::RC_LANGUAGE_AUTO_BEGIN:
2920 case LyXRC::RC_LANGUAGE_AUTO_END:
2921 case LyXRC::RC_LANGUAGE_COMMAND_BEGIN:
2922 case LyXRC::RC_LANGUAGE_COMMAND_END:
2923 case LyXRC::RC_LANGUAGE_COMMAND_LOCAL:
2924 case LyXRC::RC_LANGUAGE_GLOBAL_OPTIONS:
2925 case LyXRC::RC_LANGUAGE_CUSTOM_PACKAGE:
2926 case LyXRC::RC_LANGUAGE_PACKAGE_SELECTION:
2927 case LyXRC::RC_LYXRCFORMAT:
2928 case LyXRC::RC_MAC_DONTSWAP_CTRL_META:
2929 case LyXRC::RC_MAC_LIKE_CURSOR_MOVEMENT:
2930 case LyXRC::RC_MACRO_EDIT_STYLE:
2931 case LyXRC::RC_MAKE_BACKUP:
2932 case LyXRC::RC_MARK_FOREIGN_LANGUAGE:
2933 case LyXRC::RC_MOUSE_WHEEL_SPEED:
2934 case LyXRC::RC_MOUSE_MIDDLEBUTTON_PASTE:
2935 case LyXRC::RC_NUMLASTFILES:
2936 case LyXRC::RC_PARAGRAPH_MARKERS:
2937 case LyXRC::RC_PATH_PREFIX:
2938 if (lyxrc_orig.path_prefix != lyxrc_new.path_prefix) {
2939 prependEnvPath("PATH", lyxrc_new.path_prefix);
2940 // Resets python path
2941 support::os::python(true);
2944 case LyXRC::RC_PREVIEW:
2945 case LyXRC::RC_PREVIEW_HASHED_LABELS:
2946 case LyXRC::RC_PREVIEW_SCALE_FACTOR:
2947 case LyXRC::RC_PRINTLANDSCAPEFLAG:
2948 case LyXRC::RC_PRINTPAPERDIMENSIONFLAG:
2949 case LyXRC::RC_PRINTPAPERFLAG:
2950 case LyXRC::RC_SAVE_COMPRESSED:
2951 case LyXRC::RC_SAVE_ORIGIN:
2952 case LyXRC::RC_SCREEN_DPI:
2953 case LyXRC::RC_SCREEN_FONT_ROMAN:
2954 case LyXRC::RC_SCREEN_FONT_ROMAN_FOUNDRY:
2955 case LyXRC::RC_SCREEN_FONT_SANS:
2956 case LyXRC::RC_SCREEN_FONT_SANS_FOUNDRY:
2957 case LyXRC::RC_SCREEN_FONT_SCALABLE:
2958 case LyXRC::RC_SCREEN_FONT_SIZES:
2959 case LyXRC::RC_SCREEN_FONT_TYPEWRITER:
2960 case LyXRC::RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
2961 case LyXRC::RC_GEOMETRY_SESSION:
2962 case LyXRC::RC_SCREEN_ZOOM:
2963 case LyXRC::RC_SERVERPIPE:
2964 case LyXRC::RC_SET_COLOR:
2965 case LyXRC::RC_SHOW_BANNER:
2966 case LyXRC::RC_OPEN_BUFFERS_IN_TABS:
2967 case LyXRC::RC_SPELLCHECKER:
2968 if (lyxrc_orig.spellchecker != lyxrc_new.spellchecker)
2971 case LyXRC::RC_SPELLCHECK_CONTINUOUSLY:
2972 case LyXRC::RC_SPELLCHECK_NOTES:
2973 case LyXRC::RC_SPLITINDEX_COMMAND:
2974 case LyXRC::RC_TEMPDIRPATH:
2975 case LyXRC::RC_TEMPLATEPATH:
2976 case LyXRC::RC_TEX_ALLOWS_SPACES:
2977 case LyXRC::RC_TEX_EXPECTS_WINDOWS_PATHS:
2978 if (lyxrc_orig.windows_style_tex_paths != lyxrc_new.windows_style_tex_paths) {
2979 os::windows_style_tex_paths(lyxrc_new.windows_style_tex_paths);
2982 case LyXRC::RC_TEXINPUTS_PREFIX:
2983 case LyXRC::RC_THESAURUSDIRPATH:
2984 case LyXRC::RC_UIFILE:
2985 case LyXRC::RC_USER_EMAIL:
2986 case LyXRC::RC_USER_NAME:
2987 case LyXRC::RC_USE_CONVERTER_CACHE:
2988 case LyXRC::RC_USE_CONVERTER_NEEDAUTH_FORBIDDEN:
2989 case LyXRC::RC_USE_CONVERTER_NEEDAUTH:
2990 case LyXRC::RC_USE_NATIVE_FILEDIALOG:
2991 case LyXRC::RC_USE_SYSTEM_COLORS:
2992 case LyXRC::RC_USE_TOOLTIP:
2993 case LyXRC::RC_USE_SYSTEM_THEME_ICONS:
2994 case LyXRC::RC_VIEWDVI_PAPEROPTION:
2995 case LyXRC::RC_SINGLE_CLOSE_TAB_BUTTON:
2996 case LyXRC::RC_SINGLE_INSTANCE:
2997 case LyXRC::RC_SORT_LAYOUTS:
2998 case LyXRC::RC_FULL_SCREEN_LIMIT:
2999 case LyXRC::RC_FULL_SCREEN_SCROLLBAR:
3000 case LyXRC::RC_FULL_SCREEN_MENUBAR:
3001 case LyXRC::RC_FULL_SCREEN_STATUSBAR:
3002 case LyXRC::RC_FULL_SCREEN_TABBAR:
3003 case LyXRC::RC_FULL_SCREEN_TOOLBARS:
3004 case LyXRC::RC_FULL_SCREEN_WIDTH:
3005 case LyXRC::RC_VISUAL_CURSOR:
3006 case LyXRC::RC_CLOSE_BUFFER_WITH_LAST_VIEW:
3007 case LyXRC::RC_VIEWER:
3008 case LyXRC::RC_VIEWER_ALTERNATIVES:
3009 case LyXRC::RC_FORWARD_SEARCH_DVI:
3010 case LyXRC::RC_FORWARD_SEARCH_PDF:
3011 case LyXRC::RC_EXPORT_OVERWRITE:
3012 case LyXRC::RC_DEFAULT_DECIMAL_POINT:
3013 case LyXRC::RC_DEFAULT_LENGTH_UNIT:
3014 case LyXRC::RC_SCROLL_WHEEL_ZOOM:
3015 case LyXRC::RC_CURSOR_WIDTH:
3021 set<string> LyXRC::getRCs()
3024 for (int i = 0; i != lyxrcCount; ++i)
3025 res.insert(ltrim(lyxrcTags[i].tag, "\\"));
3031 string const LyXRC::getDescription(LyXRCTags tag)
3036 case RC_ACCEPT_COMPOUND:
3037 str = _("Consider run-together words, such as \"diskdrive\" for \"disk drive\", as legal words?");
3041 str = _("Specify an alternate language. The default is to use the language of the document.");
3044 case RC_PLAINTEXT_LINELEN:
3045 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.");
3048 case RC_AUTOREGIONDELETE:
3049 str = _("De-select if you don't want the current selection to be replaced automatically by what you type.");
3052 case RC_AUTORESET_OPTIONS:
3053 str = _("De-select if you don't want the class options to be reset to defaults after class change.");
3057 str = _("The time interval between auto-saves (in seconds). 0 means no auto-save.");
3060 case RC_AUTO_NUMBER:
3063 case RC_BACKUPDIR_PATH:
3064 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.");
3067 case RC_BIBTEX_COMMAND:
3068 str = _("Define the options of bibtex (cf. man bibtex) or select an alternative compiler (e.g. mlbibtex or bibulus).");
3071 case RC_JBIBTEX_COMMAND:
3072 str = _("Define the options of the bibtex program for PLaTeX (Japanese LaTeX).");
3076 str = _("Keybindings file. Can either specify an absolute path, or LyX will look in its global and local bind/ directories.");
3079 case RC_CHECKLASTFILES:
3080 str = _("Select to check whether the lastfiles still exist.");
3083 case RC_CHKTEX_COMMAND:
3084 str = _("Define how to run chktex. E.g. \"chktex -n11 -n1 -n3 -n6 -n9 -22 -n25 -n30 -n38\" Refer to the ChkTeX documentation.");
3090 case RC_CONVERTER_NEEDAUTH_FORBIDDEN:
3091 str = _("Forbid use of external converters with 'needauth' option to prevent undesired effects.");
3094 case RC_CONVERTER_NEEDAUTH:
3095 str = _("Ask user before calling external converters with 'needauth' option to prevent undesired effects.");
3101 case RC_CURSOR_FOLLOWS_SCROLLBAR:
3102 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.");
3105 case RC_CURSOR_WIDTH:
3106 str = _("Configure the width of the text cursor. Automatic zoom-controlled cursor width used when set to 0.");
3109 case RC_SCROLL_BELOW_DOCUMENT:
3110 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");
3113 case RC_MAC_DONTSWAP_CTRL_META:
3114 str = _("Make Apple key act as Meta and Control key as Ctrl.");
3117 case RC_MAC_LIKE_CURSOR_MOVEMENT:
3118 str = _("Use the Mac OS X conventions for cursor movement");
3121 case RC_SHOW_MACRO_LABEL:
3122 str = _("Show a small box around a Math Macro with the macro name when the cursor is inside.");
3126 str = _("Command definition file. Can either specify an absolute path, or LyX will look in its global and local commands/ directories.");
3129 case RC_DEFAULT_OTF_VIEW_FORMAT:
3130 str = _("The default format used with LFUN_BUFFER_[VIEW|UPDATE] with non-TeX fonts.");
3133 case RC_DEFAULT_VIEW_FORMAT:
3134 str = _("The default format used with LFUN_BUFFER_[VIEW|UPDATE].");
3137 case RC_DIALOGS_ICONIFY_WITH_MAIN:
3138 str = _("Iconify the dialogs when the main window is iconified. (Affects only dialogs shown after the change has been made.)");
3141 case RC_DISPLAY_GRAPHICS:
3142 str = _("Select how LyX will display any graphics.");
3145 case RC_DOCUMENTPATH:
3146 str = _("The default path for your documents. An empty value selects the directory LyX was started from.");
3150 str = _("Specify additional chars that can be part of a word.");
3153 case RC_EXAMPLEPATH:
3154 str = _("The path that LyX will set when offering to choose an example. An empty value selects the directory LyX was started from.");
3160 case RC_INDEX_COMMAND:
3161 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\".");
3164 case RC_JINDEX_COMMAND:
3165 str = _("Define the options of the index program for PLaTeX (Japanese LaTeX).");
3168 case RC_NOMENCL_COMMAND:
3169 str = _("Define the options of makeindex (cf. man makeindex) to be used for nomenclatures. This might differ from the index processing options.");
3172 case RC_PYGMENTIZE_COMMAND:
3173 str = _("The command to run the python pygments syntax highlighter.");
3180 case RC_KBMAP_PRIMARY:
3181 case RC_KBMAP_SECONDARY:
3182 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.");
3185 case RC_LANGUAGE_AUTO_BEGIN:
3186 str = _("Select if a language switching command is needed at the beginning of the document.");
3189 case RC_LANGUAGE_AUTO_END:
3190 str = _("Select if a language switching command is needed at the end of the document.");
3193 case RC_LANGUAGE_COMMAND_BEGIN:
3194 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.");
3197 case RC_LANGUAGE_COMMAND_END:
3198 str = _("The LaTeX command for changing back to the language of the document.");
3201 case RC_LANGUAGE_COMMAND_LOCAL:
3202 str = _("The LaTeX command for local changing of the language.");
3205 case RC_LANGUAGE_GLOBAL_OPTIONS:
3206 str = _("De-select if you don't want the language(s) used as an argument to \\documentclass.");
3209 case RC_LANGUAGE_CUSTOM_PACKAGE:
3210 str = _("The LaTeX command for loading the language package. E.g. \"\\usepackage{babel}\", \"\\usepackage{omega}\".");
3213 case RC_LANGUAGE_PACKAGE_SELECTION:
3214 str = _("De-select if you don't want babel to be used when the language of the document is the default language.");
3217 case RC_USELASTFILEPOS:
3218 str = _("De-select if you do not want LyX to scroll to saved position.");
3221 case RC_LOADSESSION:
3222 str = _("De-select to prevent loading files opened from the last LyX session.");
3225 case RC_MAKE_BACKUP:
3226 str = _("De-select if you don't want LyX to create backup files.");
3229 case RC_MARK_FOREIGN_LANGUAGE:
3230 str = _("Select to control the highlighting of words with a language foreign to that of the document.");
3233 case RC_MOUSE_WHEEL_SPEED:
3234 str = _("The scrolling speed of the mouse wheel.");
3237 case RC_COMPLETION_POPUP_DELAY:
3238 str = _("The completion popup delay.");
3241 case RC_COMPLETION_POPUP_MATH:
3242 str = _("Select to display the completion popup in math mode.");
3245 case RC_COMPLETION_POPUP_TEXT:
3246 str = _("Select to display the completion popup in text mode.");
3249 case RC_COMPLETION_POPUP_AFTER_COMPLETE:
3250 str = _("Show the completion popup without delay after non-unique completion attempt.");
3253 case RC_COMPLETION_POPUP_TEXT:
3254 str = _("Show a small triangle on the cursor to indicate that a completion is available.");
3257 case RC_COMPLETION_POPUP_DELAY:
3258 str = _("The inline completion delay.");
3261 case RC_COMPLETION_INLINE_MATH:
3262 str = _("Select to display the inline completion in math mode.");
3265 case RC_COMPLETION_INLINE_TEXT:
3266 str = _("Select to display the inline completion in text mode.");
3269 case RC_COMPLETION_INLINE_DOTS:
3270 str = _("Use \"...\" to shorten long completions.");
3273 case RC_AUTOCORRECTION_MATH:
3274 str = _("Allow TeXMacs shorthand, like => converting to \\Rightarrow.");
3277 case RC_NUMLASTFILES:
3278 str = bformat(_("Maximal number of lastfiles. Up to %1$d can appear in the file menu."),
3282 case RC_PATH_PREFIX:
3283 str = _("Specify those directories which should be "
3284 "prepended to the PATH environment variable.\n"
3285 "Use the OS native format.");
3289 str = _("Shows a typeset preview of things such as math");
3292 case RC_PREVIEW_HASHED_LABELS:
3293 str = _("Previewed equations will have \"(#)\" labels rather than numbered ones");
3296 case RC_PREVIEW_SCALE_FACTOR:
3297 str = _("Scale the preview size to suit.");
3300 case RC_PRINTLANDSCAPEFLAG:
3301 str = _("The option to print out in landscape.");
3304 case RC_PRINTPAPERDIMENSIONFLAG:
3305 str = _("Option to specify the dimensions of the print paper.");
3308 case RC_PRINTPAPERFLAG:
3309 str = _("The option to specify paper type.");
3312 case RC_VISUAL_CURSOR:
3313 str = _("Select to have visual bidi cursor movement, unselect for logical movement.");
3316 case RC_CLOSE_BUFFER_WITH_LAST_VIEW:
3317 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).");
3321 str = _("DPI (dots per inch) of your monitor is auto-detected by LyX. If that goes wrong, override the setting here.");
3324 case RC_SCREEN_FONT_ROMAN:
3325 case RC_SCREEN_FONT_SANS:
3326 case RC_SCREEN_FONT_TYPEWRITER:
3327 str = _("The screen fonts used to display the text while editing.");
3330 case RC_SCREEN_FONT_ROMAN_FOUNDRY:
3331 case RC_SCREEN_FONT_SANS_FOUNDRY:
3332 case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
3335 case RC_SCREEN_FONT_SCALABLE:
3336 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.");
3339 case RC_SCREEN_FONT_SIZES:
3340 str = _("The font sizes used for calculating the scaling of the screen fonts.");
3343 case RC_SCREEN_ZOOM:
3344 //xgettext:no-c-format
3345 str = _("The zoom percentage for screen fonts. A setting of 100% will make the fonts roughly the same size as on paper.");
3348 case RC_GEOMETRY_SESSION:
3349 str = _("Allow session manager to save and restore windows geometry.");
3353 str = _("This starts the lyxserver. The pipes get an additional extension \".in\" and \".out\". Only for advanced users.");
3359 case RC_SHOW_BANNER:
3360 str = _("De-select if you don't want the startup banner.");
3363 case RC_TEMPDIRPATH:
3364 str = _("LyX will place its temporary directories in this path. They will be deleted when you quit LyX.");
3367 case RC_THESAURUSDIRPATH:
3368 str = _("This is the place where the files of the thesaurus library reside.");
3371 case RC_TEMPLATEPATH:
3372 str = _("The path that LyX will set when offering to choose a template. An empty value selects the directory LyX was started from.");
3375 case RC_TEX_ALLOWS_SPACES:
3378 case RC_TEX_EXPECTS_WINDOWS_PATHS:
3381 case RC_TEXINPUTS_PREFIX:
3382 str = _("Specify those directories which should be "
3383 "prepended to the TEXINPUTS environment variable.\n"
3384 "A '.' represents the current document directory. "
3385 "Use the OS native format.");
3389 str = _("The UI (user interface) file. Can either specify an absolute path, or LyX will look in its global and local ui/ directories.");
3398 case RC_USE_USE_SYSTEM_COLORS:
3399 str = _("Enable use the system colors for some things like main window background and selection.");
3402 case RC_USE_TOOLTIP:
3403 str = _("Enable the automatic appearance of tool tips in the work area.");
3406 case RC_VIEWDVI_PAPEROPTION:
3407 _("Specify the paper command to DVI viewer (leave empty or use \"-paper\")");
3422 // The global instance
3425 // The global copy of the system lyxrc entries (everything except preferences)