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.
22 #include "Converter.h"
23 #include "FontEnums.h"
29 #include "SpellChecker.h"
32 #include "graphics/GraphicsTypes.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/gettext.h"
40 #include "support/lstrings.h"
41 #include "support/os.h"
42 #include "support/Package.h"
43 #include "support/TempFile.h"
44 #include "support/userinfo.h"
51 using namespace lyx::support;
55 namespace os = support::os;
59 // The format should also be updated in configure.py, and conversion code
60 // should be added to prefs2prefs_prefs.py.
61 static unsigned int const LYXRC_FILEFORMAT = 15; // prannoy: statusbar on/off in full screen
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 { "\\date_insert_format", LyXRC::RC_DATE_INSERT_FORMAT },
96 { "\\def_file", LyXRC::RC_DEFFILE },
97 { "\\default_decimal_point", LyXRC::RC_DEFAULT_DECIMAL_POINT },
98 { "\\default_length_unit", LyXRC::RC_DEFAULT_LENGTH_UNIT },
99 { "\\default_otf_view_format", LyXRC::RC_DEFAULT_OTF_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 { "\\font_encoding", LyXRC::RC_FONT_ENCODING },
109 { "\\force_paint_single_char", LyXRC::RC_FORCE_PAINT_SINGLE_CHAR },
110 { "\\format", LyXRC::RC_FILEFORMAT },
111 { "\\forward_search_dvi", LyXRC::RC_FORWARD_SEARCH_DVI },
112 { "\\forward_search_pdf", LyXRC::RC_FORWARD_SEARCH_PDF },
113 { "\\fullscreen_limit", LyXRC::RC_FULL_SCREEN_LIMIT },
114 { "\\fullscreen_menubar", LyXRC::RC_FULL_SCREEN_MENUBAR },
115 { "\\fullscreen_scrollbar", LyXRC::RC_FULL_SCREEN_SCROLLBAR },
116 { "\\fullscreen_statusbar", LyXRC::RC_FULL_SCREEN_STATUSBAR },
117 { "\\fullscreen_tabbar", LyXRC::RC_FULL_SCREEN_TABBAR },
118 { "\\fullscreen_toolbars", LyXRC::RC_FULL_SCREEN_TOOLBARS },
119 { "\\fullscreen_width", LyXRC::RC_FULL_SCREEN_WIDTH },
120 { "\\group_layouts", LyXRC::RC_GROUP_LAYOUTS },
121 { "\\gui_language", LyXRC::RC_GUI_LANGUAGE },
122 { "\\hunspelldir_path", LyXRC::RC_HUNSPELLDIR_PATH },
123 { "\\icon_set", LyXRC::RC_ICON_SET },
124 { "\\index_alternatives", LyXRC::RC_INDEX_ALTERNATIVES },
125 { "\\index_command", LyXRC::RC_INDEX_COMMAND },
126 { "\\input", LyXRC::RC_INPUT },
127 { "\\jbibtex_command", LyXRC::RC_JBIBTEX_COMMAND },
128 { "\\jindex_command", LyXRC::RC_JINDEX_COMMAND },
129 { "\\kbmap", LyXRC::RC_KBMAP },
130 { "\\kbmap_primary", LyXRC::RC_KBMAP_PRIMARY },
131 { "\\kbmap_secondary", LyXRC::RC_KBMAP_SECONDARY },
132 { "\\language_auto_begin", LyXRC::RC_LANGUAGE_AUTO_BEGIN },
133 { "\\language_auto_end", LyXRC::RC_LANGUAGE_AUTO_END },
134 { "\\language_command_begin", LyXRC::RC_LANGUAGE_COMMAND_BEGIN },
135 { "\\language_command_end", LyXRC::RC_LANGUAGE_COMMAND_END },
136 { "\\language_command_local", LyXRC::RC_LANGUAGE_COMMAND_LOCAL },
137 { "\\language_custom_package", LyXRC::RC_LANGUAGE_CUSTOM_PACKAGE },
138 { "\\language_global_options", LyXRC::RC_LANGUAGE_GLOBAL_OPTIONS },
139 { "\\language_package_selection", LyXRC::RC_LANGUAGE_PACKAGE_SELECTION },
140 { "\\load_session", LyXRC::RC_LOADSESSION },
141 { "\\mac_dontswap_ctrl_meta", LyXRC::RC_MAC_DONTSWAP_CTRL_META },
142 { "\\mac_like_cursor_movement", LyXRC::RC_MAC_LIKE_CURSOR_MOVEMENT },
143 { "\\macro_edit_style", LyXRC::RC_MACRO_EDIT_STYLE },
144 { "\\make_backup", LyXRC::RC_MAKE_BACKUP },
145 { "\\mark_foreign_language", LyXRC::RC_MARK_FOREIGN_LANGUAGE },
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_adapt_output", LyXRC::RC_PRINT_ADAPTOUTPUT },
157 { "\\print_collcopies_flag", LyXRC::RC_PRINTCOLLCOPIESFLAG },
158 { "\\print_command", LyXRC::RC_PRINT_COMMAND },
159 { "\\print_copies_flag", LyXRC::RC_PRINTCOPIESFLAG },
160 { "\\print_evenpage_flag", LyXRC::RC_PRINTEVENPAGEFLAG },
161 { "\\print_extra_options", LyXRC::RC_PRINTEXSTRAOPTIONS },
162 { "\\print_file_extension", LyXRC::RC_PRINTFILEEXTENSION },
163 { "\\print_landscape_flag", LyXRC::RC_PRINTLANDSCAPEFLAG },
164 { "\\print_oddpage_flag", LyXRC::RC_PRINTODDPAGEFLAG },
165 { "\\print_pagerange_flag", LyXRC::RC_PRINTPAGERANGEFLAG },
166 { "\\print_paper_dimension_flag", LyXRC::RC_PRINTPAPERDIMENSIONFLAG },
167 { "\\print_paper_flag", LyXRC::RC_PRINTPAPERFLAG },
168 { "\\print_reverse_flag", LyXRC::RC_PRINTREVERSEFLAG },
169 { "\\print_spool_command", LyXRC::RC_PRINTSPOOL_COMMAND },
170 { "\\print_spool_printerprefix", LyXRC::RC_PRINTSPOOL_PRINTERPREFIX },
171 { "\\print_to_file", LyXRC::RC_PRINTTOFILE },
172 { "\\print_to_printer", LyXRC::RC_PRINTTOPRINTER },
173 { "\\printer", LyXRC::RC_PRINTER },
174 { "\\rtl", LyXRC::RC_RTL_SUPPORT },
175 { "\\save_compressed", LyXRC::RC_SAVE_COMPRESSED },
176 { "\\screen_dpi", LyXRC::RC_SCREEN_DPI },
177 { "\\screen_font_roman", LyXRC::RC_SCREEN_FONT_ROMAN },
178 { "\\screen_font_roman_foundry", LyXRC::RC_SCREEN_FONT_ROMAN_FOUNDRY },
179 { "\\screen_font_sans", LyXRC::RC_SCREEN_FONT_SANS },
180 { "\\screen_font_sans_foundry", LyXRC::RC_SCREEN_FONT_SANS_FOUNDRY },
181 { "\\screen_font_scalable", LyXRC::RC_SCREEN_FONT_SCALABLE },
182 { "\\screen_font_sizes", LyXRC::RC_SCREEN_FONT_SIZES },
183 { "\\screen_font_typewriter", LyXRC::RC_SCREEN_FONT_TYPEWRITER },
184 { "\\screen_font_typewriter_foundry", LyXRC::RC_SCREEN_FONT_TYPEWRITER_FOUNDRY },
185 { "\\screen_zoom", LyXRC::RC_SCREEN_ZOOM },
186 { "\\scroll_below_document", LyXRC::RC_SCROLL_BELOW_DOCUMENT },
187 { "\\scroll_wheel_zoom", LyXRC::RC_SCROLL_WHEEL_ZOOM },
188 { "\\serverpipe", LyXRC::RC_SERVERPIPE },
189 { "\\set_color", LyXRC::RC_SET_COLOR },
190 { "\\show_banner", LyXRC::RC_SHOW_BANNER },
191 { "\\single_close_tab_button", LyXRC::RC_SINGLE_CLOSE_TAB_BUTTON },
192 { "\\single_instance", LyXRC::RC_SINGLE_INSTANCE },
193 { "\\sort_layouts", LyXRC::RC_SORT_LAYOUTS },
194 { "\\spellcheck_continuously", LyXRC::RC_SPELLCHECK_CONTINUOUSLY },
195 { "\\spellcheck_notes", LyXRC::RC_SPELLCHECK_NOTES },
196 { "\\spellchecker", LyXRC::RC_SPELLCHECKER },
197 { "\\splitindex_command", LyXRC::RC_SPLITINDEX_COMMAND },
198 { "\\tempdir_path", LyXRC::RC_TEMPDIRPATH },
199 { "\\template_path", LyXRC::RC_TEMPLATEPATH },
200 { "\\tex_allows_spaces", LyXRC::RC_TEX_ALLOWS_SPACES },
201 { "\\tex_expects_windows_paths", LyXRC::RC_TEX_EXPECTS_WINDOWS_PATHS },
202 { "\\texinputs_prefix", LyXRC::RC_TEXINPUTS_PREFIX },
203 { "\\thesaurusdir_path", LyXRC::RC_THESAURUSDIRPATH },
204 { "\\ui_file", LyXRC::RC_UIFILE },
205 { "\\use_converter_cache", LyXRC::RC_USE_CONVERTER_CACHE },
206 { "\\use_lastfilepos", LyXRC::RC_USELASTFILEPOS },
207 { "\\use_pixmap_cache", LyXRC::RC_USE_PIXMAP_CACHE },
208 { "\\use_qimage", LyXRC::RC_USE_QIMAGE },
209 // compatibility with versions older than 1.4.0 only
210 { "\\use_system_colors", LyXRC::RC_USE_SYSTEM_COLORS },
211 { "\\use_system_theme_icons", LyXRC::RC_USE_SYSTEM_THEME_ICONS },
212 { "\\use_tooltip", LyXRC::RC_USE_TOOLTIP },
213 { "\\user_email", LyXRC::RC_USER_EMAIL },
214 { "\\user_name", LyXRC::RC_USER_NAME },
215 { "\\view_dvi_paper_option", LyXRC::RC_VIEWDVI_PAPEROPTION },
216 // compatibility with versions older than 1.4.0 only
217 { "\\viewer", LyXRC::RC_VIEWER},
218 { "\\viewer_alternatives", LyXRC::RC_VIEWER_ALTERNATIVES },
219 { "\\visual_cursor", LyXRC::RC_VISUAL_CURSOR },
220 { "format", LyXRC::RC_LYXRCFORMAT }
223 const int lyxrcCount = sizeof(lyxrcTags) / sizeof(lyxrcTags[0]);
234 void LyXRC::setDefaults()
237 use_system_theme_icons = false;
239 def_file = "default";
241 // The current document directory
242 texinputs_prefix = ".";
243 // Get printer from the environment. If fail, use default "",
244 // assuming that everything is set up correctly.
245 printer = getEnv("PRINTER");
246 print_adapt_output = false;
247 print_command = "dvips";
248 print_evenpage_flag = "-B";
249 print_oddpage_flag = "-A";
250 print_pagerange_flag = "-pp";
251 print_copies_flag = "-c";
252 print_collcopies_flag = "-C";
253 print_reverse_flag = "-r";
254 print_landscape_flag = "-t landscape";
255 print_to_printer = "-P";
256 print_to_file = "-o ";
257 print_file_extension = ".ps";
258 print_paper_flag = "-t";
259 print_paper_dimension_flag = "-T";
260 document_path.erase();
261 view_dvi_paper_option.erase();
262 default_view_format = "pdf2";
263 default_otf_view_format = "pdf4";
264 chktex_command = "chktex -n1 -n3 -n6 -n9 -n22 -n25 -n30 -n38";
265 bibtex_command = "bibtex";
267 index_command = "makeindex -c -q";
268 nomencl_command = "makeindex -s nomencl.ist";
270 // Because a screen is typically wider than a piece of paper:
272 allow_geometry_session = true;
273 // Default LaTeX font size:
274 font_sizes[FONT_SIZE_TINY] = "5.0";
275 font_sizes[FONT_SIZE_SCRIPT] = "7.0";
276 font_sizes[FONT_SIZE_FOOTNOTE] = "8.0";
277 font_sizes[FONT_SIZE_SMALL] = "9.0";
278 font_sizes[FONT_SIZE_NORMAL] = "10.0";
279 font_sizes[FONT_SIZE_LARGE] = "12.0";
280 font_sizes[FONT_SIZE_LARGER] = "14.4";
281 font_sizes[FONT_SIZE_LARGEST] = "17.26";
282 font_sizes[FONT_SIZE_HUGE] = "20.74";
283 font_sizes[FONT_SIZE_HUGER] = "24.88";
284 use_scalable_fonts = true;
285 roman_font_name = "";
287 typewriter_font_name = "";
289 auto_region_delete = true;
290 auto_reset_options = false;
291 plaintext_linelen = 65;
292 mouse_wheel_speed = 1.0;
293 num_lastfiles = maxlastfiles;
294 check_lastfiles = true;
295 use_lastfilepos = true;
296 load_session = false;
298 save_compressed = false;
299 backupdir_path.erase();
300 display_graphics = true;
301 // Spellchecker settings:
302 // FIXME: this check should test the target platform (darwin)
303 #if defined(USE_MACOSX_PACKAGING)
304 spellchecker = "native";
305 #elif defined(USE_ASPELL)
306 spellchecker = "aspell";
307 #elif defined(USE_HUNSPELL)
308 spellchecker = "hunspell";
310 spellchecker = "aspell";
312 spellchecker_accept_compound = false;
313 spellcheck_continuously = false;
314 completion_minlength = 6;
315 spellcheck_notes = true;
318 visual_cursor = false;
320 mark_foreign_language = true;
321 language_auto_begin = true;
322 language_auto_end = true;
323 language_global_options = true;
324 language_package_selection = LP_AUTO;
325 language_custom_package = "\\usepackage{babel}";
326 language_command_begin = "\\selectlanguage{$$lang}";
327 language_command_local = "\\foreignlanguage{$$lang}{";
328 sort_layouts = false;
329 group_layouts = true;
330 gui_language = "auto";
332 windows_style_tex_paths = false;
333 tex_allows_spaces = false;
334 date_insert_format = "%x";
335 cursor_follows_scrollbar = false;
336 scroll_below_document = false;
337 scroll_wheel_zoom = SCROLL_WHEEL_ZOOM_CTRL;
338 paragraph_markers = false;
339 mac_dontswap_ctrl_meta = false;
340 mac_like_cursor_movement = false;
341 macro_edit_style = MACRO_EDIT_INLINE_BOX;
342 dialogs_iconify_with_main = false;
343 preview = PREVIEW_OFF;
344 preview_hashed_labels = false;
345 preview_scale_factor = 1.0;
346 use_converter_cache = true;
347 use_system_colors = false;
349 use_pixmap_cache = false;
351 converter_cache_maxage = 6 * 30 * 24 * 3600; // 6 months
352 user_name = to_utf8(support::user_name());
353 user_email = to_utf8(support::user_email());
354 open_buffers_in_tabs = true;
355 single_close_tab_button = false;
356 single_instance = true;
357 forward_search_dvi = string();
358 forward_search_pdf = string();
359 export_overwrite = NO_FILES;
361 // Fullscreen settings
362 full_screen_limit = false;
363 full_screen_toolbars = true;
364 full_screen_tabbar = true;
365 full_screen_menubar = true;
366 full_screen_scrollbar = true;
367 full_screen_width = 700;
369 completion_cursor_text = true;
370 completion_popup_math = true;
371 completion_popup_text = false;
372 completion_popup_delay = 2.0;
373 completion_popup_after_complete = true;
374 autocorrection_math = false;
375 completion_inline_math = true;
376 completion_inline_text = false;
377 completion_inline_dots = -1;
378 completion_inline_delay = 0.2;
379 default_decimal_point = ".";
380 default_length_unit = Length::CM;
382 close_buffer_with_last_view = "yes";
388 void oldFontFormat(string & family, string & foundry)
390 if (family.empty() || family[0] != '-')
392 foundry = token(family, '-', 1);
393 family = token(family, '-', 2);
401 bool LyXRC::read(FileName const & filename, bool check_format)
403 Lexer lexrc(lyxrcTags);
404 lexrc.setFile(filename);
405 LYXERR(Debug::LYXRC, "Reading '" << filename << "'...");
406 ReturnValues retval = read(lexrc, check_format);
407 if (!check_format || retval != FormatMismatch)
408 return retval == ReadOK;
410 LYXERR(Debug::FILES, "Converting LyXRC file to " << LYXRC_FILEFORMAT);
411 TempFile tmp("convert_lyxrc");
412 FileName const tempfile = tmp.name();
413 bool const success = prefs2prefs(filename, tempfile, false);
415 LYXERR0 ("Unable to convert " << filename.absFileName() <<
416 " to format " << LYXRC_FILEFORMAT);
419 // Keep this in the else branch, such that lexrc2 goes out
420 // of scope and releases the lock on tempfile before we
421 // attempt to remove it. This matters on Windows.
422 Lexer lexrc2(lyxrcTags);
423 lexrc2.setFile(tempfile);
424 LYXERR(Debug::LYXRC, "Reading '" << tempfile << "'...");
425 retval = read(lexrc2, check_format);
427 return retval == ReadOK;
431 // don't need to worry about conversion, because this is always
432 // from an internal source
433 bool LyXRC::read(istream & is)
435 Lexer lexrc(lyxrcTags);
437 LYXERR(Debug::LYXRC, "Reading istream...");
438 return read(lexrc, false) == ReadOK;
442 LyXRC::ReturnValues LyXRC::read(Lexer & lexrc, bool check_format)
444 if (lyxerr.debugging(Debug::PARSER))
445 lexrc.printTable(lyxerr);
450 // default for current rowpainter capabilities
451 force_paint_single_char = true;
453 // format prior to 2.0 and introduction of format tag
454 unsigned int format = 0;
456 while (lexrc.isOK()) {
457 // By using two switches we take advantage of the compiler
458 // telling us if we have missed a LyXRCTags element in
459 // the second switch.
460 // Note that this also shows a problem with Lexer since it
461 // helps us avoid taking advantage of the strictness of the
464 int le = lexrc.lex();
466 case Lexer::LEX_UNDEF:
467 lexrc.printError("Unknown tag `$$Token'");
469 case Lexer::LEX_FEOF:
474 switch (static_cast<LyXRCTags>(le)) {
477 format = lexrc.getInteger();
479 case RC_INPUT: // Include file
482 libFileSearch(string(),
484 if (read(tmp, check_format)) {
486 "Error reading included file: " + tmp.absFileName());
492 bind_file = os::internal_path(lexrc.getString());
497 def_file = os::internal_path(lexrc.getString());
502 ui_file = os::internal_path(lexrc.getString());
505 case RC_AUTORESET_OPTIONS:
506 lexrc >> auto_reset_options;
509 case RC_DISPLAY_GRAPHICS:
511 display_graphics = lexrc.getString() == "true";
514 case RC_TEX_EXPECTS_WINDOWS_PATHS:
515 lexrc >> windows_style_tex_paths;
518 case RC_TEX_ALLOWS_SPACES:
519 lexrc >> tex_allows_spaces;
522 case RC_TEXINPUTS_PREFIX:
523 lexrc >> texinputs_prefix;
530 case RC_KBMAP_PRIMARY:
532 string const kmap(os::internal_path(lexrc.getString()));
533 if (!libFileSearch("kbd", kmap, "kmap").empty()
535 primary_kbmap = kmap;
537 lexrc.printError("LyX: Keymap `$$Token' not found");
542 case RC_KBMAP_SECONDARY:
544 string const kmap(os::internal_path(lexrc.getString()));
545 if (!libFileSearch("kbd", kmap, "kmap").empty()
547 secondary_kbmap = kmap;
549 lexrc.printError("LyX: Keymap `$$Token' not found");
554 case RC_FONT_ENCODING:
558 case RC_FORCE_PAINT_SINGLE_CHAR:
559 lexrc >> force_paint_single_char;
566 case RC_PRINT_COMMAND:
567 if (lexrc.next(true)) {
568 print_command = lexrc.getString();
572 case RC_PRINTEVENPAGEFLAG:
573 lexrc >> print_evenpage_flag;
576 case RC_PRINTODDPAGEFLAG:
577 lexrc >> print_oddpage_flag;
580 case RC_PRINTPAGERANGEFLAG:
581 lexrc >> print_pagerange_flag;
584 case RC_PRINTCOPIESFLAG:
585 lexrc >> print_copies_flag;
588 case RC_PRINTCOLLCOPIESFLAG:
589 lexrc >> print_collcopies_flag;
592 case RC_PRINTREVERSEFLAG:
593 lexrc >> print_reverse_flag;
596 case RC_PRINTLANDSCAPEFLAG:
597 lexrc >> print_landscape_flag;
600 case RC_PRINTTOPRINTER:
601 lexrc >> print_to_printer;
604 case RC_PRINT_ADAPTOUTPUT:
605 lexrc >> print_adapt_output;
610 print_to_file = os::internal_path(lexrc.getString());
614 case RC_PRINTFILEEXTENSION:
615 lexrc >> print_file_extension;
618 case RC_PRINTEXSTRAOPTIONS:
619 lexrc >> print_extra_options;
622 case RC_PRINTSPOOL_COMMAND:
623 if (lexrc.next(true)) {
624 print_spool_command = lexrc.getString();
628 case RC_PRINTSPOOL_PRINTERPREFIX:
629 lexrc >> print_spool_printerprefix;
632 case RC_PRINTPAPERDIMENSIONFLAG:
633 lexrc >> print_paper_dimension_flag;
636 case RC_PRINTPAPERFLAG:
637 lexrc >> print_paper_flag;
640 case RC_VIEWDVI_PAPEROPTION:
642 view_dvi_paper_option = lexrc.getString();
644 view_dvi_paper_option.erase();
647 case RC_CHKTEX_COMMAND:
648 if (lexrc.next(true)) {
649 chktex_command = lexrc.getString();
653 case RC_BIBTEX_ALTERNATIVES:
654 if (lexrc.next(true)) {
655 bibtex_alternatives.insert(lexrc.getString());
659 case RC_BIBTEX_COMMAND:
660 if (lexrc.next(true)) {
661 bibtex_command = lexrc.getString();
665 case RC_JBIBTEX_COMMAND:
666 if (lexrc.next(true)) {
667 jbibtex_command = lexrc.getString();
671 case RC_INDEX_ALTERNATIVES:
672 if (lexrc.next(true)) {
673 index_alternatives.insert(lexrc.getString());
677 case RC_INDEX_COMMAND:
678 if (lexrc.next(true)) {
679 index_command = lexrc.getString();
683 case RC_JINDEX_COMMAND:
684 if (lexrc.next(true)) {
685 jindex_command = lexrc.getString();
689 case RC_SPLITINDEX_COMMAND:
690 if (lexrc.next(true)) {
691 splitindex_command = lexrc.getString();
695 case RC_NOMENCL_COMMAND:
696 if (lexrc.next(true)) {
697 nomencl_command = lexrc.getString();
709 case RC_GEOMETRY_SESSION:
710 lexrc >> allow_geometry_session;
713 case RC_SCREEN_FONT_SIZES:
714 lexrc >> font_sizes[FONT_SIZE_TINY];
715 lexrc >> font_sizes[FONT_SIZE_SCRIPT];
716 lexrc >> font_sizes[FONT_SIZE_FOOTNOTE];
717 lexrc >> font_sizes[FONT_SIZE_SMALL];
718 lexrc >> font_sizes[FONT_SIZE_NORMAL];
719 lexrc >> font_sizes[FONT_SIZE_LARGE];
720 lexrc >> font_sizes[FONT_SIZE_LARGER];
721 lexrc >> font_sizes[FONT_SIZE_LARGEST];
722 lexrc >> font_sizes[FONT_SIZE_HUGE];
723 lexrc >> font_sizes[FONT_SIZE_HUGER];
726 case RC_SCREEN_FONT_SCALABLE:
727 lexrc >> use_scalable_fonts;
734 case RC_DOCUMENTPATH:
736 document_path = os::internal_path(lexrc.getString());
737 document_path = expandPath(document_path);
743 example_path = os::internal_path(lexrc.getString());
744 example_path = expandPath(example_path);
748 case RC_TEMPLATEPATH:
750 template_path = os::internal_path(lexrc.getString());
751 template_path = expandPath(template_path);
757 tempdir_path = os::internal_path(lexrc.getString());
758 tempdir_path = expandPath(tempdir_path);
762 case RC_THESAURUSDIRPATH:
764 thesaurusdir_path = os::internal_path(lexrc.getString());
765 thesaurusdir_path = expandPath(thesaurusdir_path);
769 case RC_HUNSPELLDIR_PATH:
771 hunspelldir_path = os::internal_path(lexrc.getString());
772 hunspelldir_path = expandPath(hunspelldir_path);
776 case RC_USELASTFILEPOS:
777 lexrc >> use_lastfilepos;
781 lexrc >> load_session;
784 case RC_MOUSE_WHEEL_SPEED:
785 lexrc >> mouse_wheel_speed;
788 case RC_COMPLETION_INLINE_DELAY:
789 lexrc >> completion_inline_delay;
792 case RC_COMPLETION_INLINE_MATH:
793 lexrc >> completion_inline_math;
796 case RC_COMPLETION_INLINE_TEXT:
797 lexrc >> completion_inline_text;
800 case RC_COMPLETION_INLINE_DOTS:
801 lexrc >> completion_inline_dots;
804 case RC_AUTOCORRECTION_MATH:
805 lexrc >> autocorrection_math;
808 case RC_COMPLETION_POPUP_DELAY:
809 lexrc >> completion_popup_delay;
812 case RC_COMPLETION_POPUP_MATH:
813 lexrc >> completion_popup_math;
816 case RC_COMPLETION_POPUP_TEXT:
817 lexrc >> completion_popup_text;
820 case RC_COMPLETION_CURSOR_TEXT:
821 lexrc >> completion_cursor_text;
824 case RC_COMPLETION_POPUP_AFTER_COMPLETE:
825 lexrc >> completion_popup_after_complete;
828 case RC_COMPLETION_MINLENGTH:
829 lexrc >> completion_minlength;
832 case RC_NUMLASTFILES:
833 lexrc >> num_lastfiles;
836 case RC_CHECKLASTFILES:
837 lexrc >> check_lastfiles;
844 case RC_USE_SYSTEM_THEME_ICONS:
845 lexrc >> use_system_theme_icons;
848 case RC_SCREEN_FONT_ROMAN:
850 roman_font_name = lexrc.getString();
851 oldFontFormat(roman_font_name,
856 case RC_SCREEN_FONT_SANS:
858 sans_font_name = lexrc.getString();
859 oldFontFormat(sans_font_name, sans_font_foundry);
863 case RC_SCREEN_FONT_TYPEWRITER:
865 typewriter_font_name = lexrc.getString();
866 oldFontFormat(typewriter_font_name,
867 typewriter_font_foundry);
871 case RC_SCREEN_FONT_ROMAN_FOUNDRY:
872 lexrc >> roman_font_foundry;
875 case RC_SCREEN_FONT_SANS_FOUNDRY:
876 lexrc >> sans_font_foundry;
879 case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
880 lexrc >> typewriter_font_foundry;
885 lexrc.printError("Missing color tag.");
888 string lyx_name = lexrc.getString();
891 lexrc.printError("Missing color name for color: `$$Token'");
894 string x11_name = lexrc.getString();
896 ColorCode const col =
897 lcolor.getFromLyXName(lyx_name);
898 if (col == Color_none ||
899 col == Color_inherit ||
903 if (!lcolor.setColor(col, x11_name))
904 LYXERR0("Bad lyxrc set_color for " << lyx_name);
908 case RC_AUTOREGIONDELETE:
909 // Auto region delete defaults to true
910 lexrc >> auto_region_delete;
915 lyxpipes = os::internal_path(lexrc.getString());
916 lyxpipes = expandPath(lyxpipes);
920 case RC_CURSOR_FOLLOWS_SCROLLBAR:
921 lexrc >> cursor_follows_scrollbar;
924 case RC_CURSOR_WIDTH:
925 lexrc >> cursor_width;
928 case RC_SCROLL_BELOW_DOCUMENT:
929 lexrc >> scroll_below_document;
932 case RC_PARAGRAPH_MARKERS:
933 lexrc >> paragraph_markers;
936 case RC_MAC_DONTSWAP_CTRL_META:
937 lexrc >> mac_dontswap_ctrl_meta;
940 case RC_MAC_LIKE_CURSOR_MOVEMENT:
941 lexrc >> mac_like_cursor_movement;
944 case RC_MACRO_EDIT_STYLE:
946 switch (lexrc.getInteger()) {
947 case 0: macro_edit_style = MACRO_EDIT_INLINE_BOX; break;
948 case 1: macro_edit_style = MACRO_EDIT_INLINE; break;
949 case 2: macro_edit_style = MACRO_EDIT_LIST; break;
954 case RC_DIALOGS_ICONIFY_WITH_MAIN:
955 lexrc >> dialogs_iconify_with_main;
958 case RC_PLAINTEXT_LINELEN:
959 lexrc >> plaintext_linelen;
961 // Spellchecker settings:
962 case RC_ACCEPT_COMPOUND:
963 lexrc >> spellchecker_accept_compound;
965 case RC_USE_SYSTEM_COLORS:
966 lexrc >> use_system_colors;
969 lexrc >> use_tooltip;
971 case RC_USE_PIXMAP_CACHE:
972 lexrc >> use_pixmap_cache;
977 case RC_SPELLCHECKER:
978 lexrc >> spellchecker;
981 lexrc >> spellchecker_alt_lang;
984 lexrc >> spellchecker_esc_chars;
986 case RC_SPELLCHECK_CONTINUOUSLY:
987 lexrc >> spellcheck_continuously;
989 case RC_SPELLCHECK_NOTES:
990 lexrc >> spellcheck_notes;
993 lexrc >> make_backup;
995 case RC_SAVE_COMPRESSED:
996 lexrc >> save_compressed;
998 case RC_BACKUPDIR_PATH:
1000 backupdir_path = os::internal_path(lexrc.getString());
1001 backupdir_path = expandPath(backupdir_path);
1004 case RC_DEFAULT_DECIMAL_POINT:
1005 lexrc >> default_decimal_point;
1007 case RC_DEFAULT_LENGTH_UNIT:
1009 default_length_unit = (Length::UNIT) lexrc.getInteger();
1011 case RC_DATE_INSERT_FORMAT:
1012 lexrc >> date_insert_format;
1014 case RC_LANGUAGE_CUSTOM_PACKAGE:
1015 lexrc >> language_custom_package;
1017 case RC_LANGUAGE_AUTO_BEGIN:
1018 lexrc >> language_auto_begin;
1020 case RC_LANGUAGE_AUTO_END:
1021 lexrc >> language_auto_end;
1023 case RC_LANGUAGE_GLOBAL_OPTIONS:
1024 lexrc >> language_global_options;
1026 case RC_LANGUAGE_PACKAGE_SELECTION:
1028 switch (lexrc.getInteger()) {
1030 language_package_selection = LP_AUTO;
1033 language_package_selection = LP_BABEL;
1036 language_package_selection = LP_CUSTOM;
1039 language_package_selection = LP_NONE;
1044 case RC_LANGUAGE_COMMAND_BEGIN:
1045 lexrc >> language_command_begin;
1047 case RC_LANGUAGE_COMMAND_END:
1048 lexrc >> language_command_end;
1050 case RC_LANGUAGE_COMMAND_LOCAL:
1051 lexrc >> language_command_local;
1053 case RC_RTL_SUPPORT:
1054 lexrc >> rtl_support;
1056 case RC_VISUAL_CURSOR:
1057 lexrc >> visual_cursor;
1059 case RC_CLOSE_BUFFER_WITH_LAST_VIEW:
1060 lexrc >> close_buffer_with_last_view;
1062 case RC_AUTO_NUMBER:
1063 lexrc >> auto_number;
1065 case RC_MARK_FOREIGN_LANGUAGE:
1066 lexrc >> mark_foreign_language;
1070 string fmt, command;
1072 fmt = lexrc.getString();
1073 if (lexrc.next(true))
1074 command = lexrc.getString();
1075 setMover(fmt, command);
1079 case RC_CONVERTER: {
1080 string from, to, command, flags;
1082 from = lexrc.getString();
1084 to = lexrc.getString();
1085 if (lexrc.next(true))
1086 command = lexrc.getString();
1088 flags = lexrc.getString();
1089 if (command.empty())
1090 theConverters().erase(from, to);
1092 theConverters().add(from, to, command, flags);
1095 // compatibility with versions older than 1.4.0 only
1097 string format, command;
1098 lexrc >> format >> command;
1099 formats.setViewer(format, command);
1102 case RC_FILEFORMAT: {
1104 string format, extensions, prettyname, shortcut;
1105 if (!(lexrc >> format >> extensions))
1107 if (ok && lexrc.next(true))
1108 prettyname = lexrc.getString();
1112 if(!(lexrc >> shortcut))
1114 string viewer, editor;
1115 if (ok && lexrc.next(true))
1116 viewer = lexrc.getString();
1119 if (ok && lexrc.next(true))
1120 editor = lexrc.getString();
1124 if (!(lexrc >> flags >> mime))
1126 int flgs = Format::none;
1127 while (!flags.empty()) {
1129 flags = split(flags, flag, ',');
1130 if (flag == "document")
1131 flgs |= Format::document;
1132 else if (flag == "vector")
1133 flgs |= Format::vector;
1134 else if (flag == "zipped=native")
1135 flgs |= Format::zipped_native;
1136 else if (flag == "menu=export")
1137 flgs |= Format::export_menu;
1139 LYXERR0("Ignoring unknown flag `"
1140 << flag << "' for format `"
1144 LYXERR0("Syntax error in format " << format);
1145 else if (prettyname.empty()) {
1146 if (theConverters().formatIsUsed(format))
1147 LYXERR0("Can't delete format " << format);
1149 formats.erase(format);
1151 formats.add(format, extensions, prettyname,
1152 shortcut, viewer, editor, mime, flgs);
1156 case RC_VIEWER_ALTERNATIVES: {
1157 string format, command;
1160 viewer_alternatives[format].insert(command);
1163 case RC_EDITOR_ALTERNATIVES: {
1164 string format, command;
1167 editor_alternatives[format].insert(command);
1171 case RC_DEFAULT_OTF_VIEW_FORMAT:
1172 lexrc >> default_otf_view_format;
1175 case RC_DEFAULT_VIEW_FORMAT:
1176 lexrc >> default_view_format;
1179 case RC_GUI_LANGUAGE:
1180 lexrc >> gui_language;
1183 case RC_SHOW_BANNER:
1184 lexrc >> show_banner;
1189 string const tmp = lexrc.getString();
1190 if (tmp == "true" || tmp == "on")
1191 preview = PREVIEW_ON;
1192 else if (tmp == "no_math")
1193 preview = PREVIEW_NO_MATH;
1195 preview = PREVIEW_OFF;
1196 if (tmp != "false" && tmp != "off")
1197 LYXERR0("Unrecognized preview status \""
1203 case RC_PREVIEW_HASHED_LABELS:
1204 lexrc >> preview_hashed_labels;
1207 case RC_PREVIEW_SCALE_FACTOR:
1208 lexrc >> preview_scale_factor;
1215 lexrc >> user_email;
1218 case RC_PATH_PREFIX:
1219 lexrc >> path_prefix;
1222 case RC_USE_CONVERTER_CACHE:
1223 lexrc >> use_converter_cache;
1225 case RC_CONVERTER_CACHE_MAXAGE:
1226 lexrc >> converter_cache_maxage;
1229 case RC_SORT_LAYOUTS:
1230 lexrc >> sort_layouts;
1232 case RC_GROUP_LAYOUTS:
1233 lexrc >> group_layouts;
1235 case RC_FULL_SCREEN_LIMIT:
1236 lexrc >> full_screen_limit;
1238 case RC_FULL_SCREEN_TOOLBARS:
1239 lexrc >> full_screen_toolbars;
1241 case RC_FULL_SCREEN_SCROLLBAR:
1242 lexrc >> full_screen_scrollbar;
1244 case RC_FULL_SCREEN_STATUSBAR:
1245 lexrc >> full_screen_statusbar;
1247 case RC_FULL_SCREEN_TABBAR:
1248 lexrc >> full_screen_tabbar;
1250 case RC_FULL_SCREEN_MENUBAR:
1251 lexrc >> full_screen_menubar;
1253 case RC_FULL_SCREEN_WIDTH:
1254 lexrc >> full_screen_width;
1256 case RC_OPEN_BUFFERS_IN_TABS:
1257 lexrc >> open_buffers_in_tabs;
1259 case RC_SINGLE_CLOSE_TAB_BUTTON:
1260 lexrc >> single_close_tab_button;
1262 case RC_SINGLE_INSTANCE:
1263 lexrc >> single_instance;
1264 if (run_mode == PREFERRED)
1265 run_mode = single_instance ? USE_REMOTE : NEW_INSTANCE;
1267 case RC_FORWARD_SEARCH_DVI:
1268 if (lexrc.next(true))
1269 forward_search_dvi = lexrc.getString();
1271 case RC_FORWARD_SEARCH_PDF:
1272 if (lexrc.next(true))
1273 forward_search_pdf = lexrc.getString();
1275 case RC_EXPORT_OVERWRITE:
1277 string const tmp = lexrc.getString();
1278 if (tmp == "all" || tmp == "true")
1279 export_overwrite = ALL_FILES;
1280 else if (tmp == "main")
1281 export_overwrite = MAIN_FILE;
1283 export_overwrite = NO_FILES;
1284 if (tmp != "ask" && tmp != "false")
1285 LYXERR0("Unrecognized export_overwrite status \""
1290 case RC_SCROLL_WHEEL_ZOOM:
1292 string const tmp = lexrc.getString();
1294 scroll_wheel_zoom = SCROLL_WHEEL_ZOOM_CTRL;
1295 else if (tmp == "shift")
1296 scroll_wheel_zoom = SCROLL_WHEEL_ZOOM_SHIFT;
1297 else if (tmp == "alt")
1298 scroll_wheel_zoom = SCROLL_WHEEL_ZOOM_ALT;
1300 scroll_wheel_zoom = SCROLL_WHEEL_ZOOM_OFF;
1301 if (tmp != "off" && tmp != "false")
1302 LYXERR0("Unrecognized scroll_wheel_zoom status \""
1309 break; // this is just a dummy
1312 // This is triggered the first time through the loop unless
1313 // we hit a format tag.
1314 if (check_format && format != LYXRC_FILEFORMAT)
1315 return FormatMismatch;
1318 /// Update converters data-structures
1319 theConverters().update(formats);
1320 theConverters().buildGraph();
1326 void LyXRC::write(FileName const & filename, bool ignore_system_lyxrc) const
1328 ofstream ofs(filename.toFilesystemEncoding().c_str());
1330 write(ofs, ignore_system_lyxrc);
1334 void LyXRC::print() const
1336 if (lyxerr.debugging())
1337 write(lyxerr, false);
1345 typedef pair<string, SpecialisedMover> Data;
1347 SameMover(Data const & comparison)
1348 : comparison_(comparison) {}
1350 bool operator()(Data const & data) const
1352 return data.first == comparison_.first &&
1353 data.second.command() == comparison_.second.command();
1363 // Escape \ and " so that LyXLex can read the string later
1364 string escapeCommand(string const & str) {
1365 return subst(subst(str , "\\", "\\\\"),
1372 void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) const
1374 LyXRCTags tag = RC_LAST;
1376 if (!name.empty()) {
1377 for (int i = 0; i != lyxrcCount; ++i)
1378 if ("\\" + name == lyxrcTags[i].tag)
1379 tag = static_cast<LyXRCTags>(lyxrcTags[i].code);
1383 os << "# LyX " << lyx_version
1384 << " generated this file. If you want to make your own\n"
1385 << "# modifications you should do them from inside LyX and save.\n\n"
1386 << "Format " << LYXRC_FILEFORMAT << "\n\n";
1388 // Why the switch you might ask. It is a trick to ensure that all
1389 // the elements in the LyXRCTags enum are handled. As you can see
1390 // there are no breaks at all. So it is just a huge fall-through.
1391 // The nice thing is that we will get a warning from the compiler
1392 // if we forget an element.
1396 // input/include files are not done here
1397 case RC_LYXRCFORMAT:
1399 if (ignore_system_lyxrc ||
1400 bind_file != system_lyxrc.bind_file) {
1401 string const path = os::external_path(bind_file);
1402 os << "\\bind_file \"" << path << "\"\n";
1408 if (ignore_system_lyxrc ||
1409 def_file != system_lyxrc.def_file) {
1410 string const path = os::external_path(def_file);
1411 os << "\\def_file \"" << path << "\"\n";
1420 << "# MISC SECTION ######################################\n"
1422 // bind files are not done here.
1424 case RC_PATH_PREFIX:
1425 if (ignore_system_lyxrc ||
1426 path_prefix != system_lyxrc.path_prefix) {
1427 os << "\\path_prefix \"" << path_prefix << "\"\n";
1432 if (ignore_system_lyxrc ||
1433 ui_file != system_lyxrc.ui_file) {
1434 string const path = os::external_path(ui_file);
1435 os << "\\ui_file \"" << path << "\"\n";
1439 case RC_AUTOREGIONDELETE:
1440 if (ignore_system_lyxrc ||
1441 auto_region_delete != system_lyxrc.auto_region_delete) {
1442 os << "# Set to false to inhibit automatic replacement of\n"
1443 << "# the current selection.\n"
1444 << "\\auto_region_delete " << convert<string>(auto_region_delete)
1449 case RC_AUTORESET_OPTIONS:
1450 if (ignore_system_lyxrc ||
1451 auto_reset_options != system_lyxrc.auto_reset_options) {
1452 os << "# Set to false to inhibit automatic reset of\n"
1453 << "# the class options to defaults on class change.\n"
1454 << "\\auto_reset_options "
1455 << convert<string>(auto_reset_options)
1461 if (ignore_system_lyxrc ||
1462 autosave != system_lyxrc.autosave) {
1463 os << "# The time interval between auto-saves in seconds.\n"
1464 << "\\autosave " << autosave << '\n';
1468 case RC_DISPLAY_GRAPHICS:
1469 if (ignore_system_lyxrc ||
1470 display_graphics != system_lyxrc.display_graphics) {
1471 os << "# Display graphics within LyX\n"
1473 << "\\display_graphics "
1474 << (display_graphics ? "true" : "false")
1479 case RC_SORT_LAYOUTS:
1480 if (ignore_system_lyxrc ||
1481 sort_layouts != system_lyxrc.sort_layouts) {
1482 os << "# Sort layouts alphabetically.\n"
1483 << "\\sort_layouts " << convert<string>(sort_layouts) << '\n';
1487 case RC_GROUP_LAYOUTS:
1488 if (ignore_system_lyxrc ||
1489 group_layouts != system_lyxrc.group_layouts) {
1490 os << "# Group layouts by their category.\n"
1491 << "\\group_layouts " << convert<string>(group_layouts) << '\n';
1495 case RC_VIEWDVI_PAPEROPTION:
1496 if (ignore_system_lyxrc ||
1497 view_dvi_paper_option
1498 != system_lyxrc.view_dvi_paper_option) {
1499 os << "# Options used to specify paper size to the\n"
1500 << "# view_dvi_command (e.g. -paper)\n"
1501 << "\\view_dvi_paper_option \""
1502 << view_dvi_paper_option << "\"\n";
1506 case RC_CHKTEX_COMMAND:
1507 if (ignore_system_lyxrc ||
1508 chktex_command != system_lyxrc.chktex_command) {
1509 os << "\\chktex_command \"" << escapeCommand(chktex_command) << "\"\n";
1513 case RC_BIBTEX_ALTERNATIVES: {
1514 CommandSet::const_iterator it = bibtex_alternatives.begin();
1515 CommandSet::const_iterator end = bibtex_alternatives.end();
1516 for ( ; it != end; ++it) {
1517 if (ignore_system_lyxrc
1518 || !system_lyxrc.bibtex_alternatives.count(*it))
1519 os << "\\bibtex_alternatives \""
1525 case RC_BIBTEX_COMMAND:
1526 if (ignore_system_lyxrc ||
1527 bibtex_command != system_lyxrc.bibtex_command) {
1528 os << "\\bibtex_command \"" << escapeCommand(bibtex_command) << "\"\n";
1532 case RC_JBIBTEX_COMMAND:
1533 if (ignore_system_lyxrc ||
1534 jbibtex_command != system_lyxrc.jbibtex_command) {
1535 os << "\\jbibtex_command \"" << escapeCommand(jbibtex_command) << "\"\n";
1539 case RC_INDEX_ALTERNATIVES: {
1540 CommandSet::const_iterator it = index_alternatives.begin();
1541 CommandSet::const_iterator end = index_alternatives.end();
1542 for ( ; it != end; ++it) {
1543 if (ignore_system_lyxrc
1544 || !system_lyxrc.index_alternatives.count(*it))
1545 os << "\\index_alternatives \""
1551 case RC_INDEX_COMMAND:
1552 if (ignore_system_lyxrc ||
1553 index_command != system_lyxrc.index_command) {
1554 os << "\\index_command \"" << escapeCommand(index_command) << "\"\n";
1558 case RC_JINDEX_COMMAND:
1559 if (ignore_system_lyxrc ||
1560 jindex_command != system_lyxrc.jindex_command) {
1561 os << "\\jindex_command \"" << escapeCommand(jindex_command) << "\"\n";
1565 case RC_SPLITINDEX_COMMAND:
1566 if (ignore_system_lyxrc ||
1567 splitindex_command != system_lyxrc.splitindex_command) {
1568 os << "\\splitindex_command \"" << escapeCommand(splitindex_command) << "\"\n";
1572 case RC_NOMENCL_COMMAND:
1573 if (ignore_system_lyxrc ||
1574 nomencl_command != system_lyxrc.nomencl_command) {
1575 os << "\\nomencl_command \"" << escapeCommand(nomencl_command) << "\"\n";
1579 case RC_TEX_EXPECTS_WINDOWS_PATHS:
1580 // Don't write this setting to the preferences file,
1581 // but allow temporary changes (bug 7557).
1582 if (ignore_system_lyxrc) {
1583 os << "\\tex_expects_windows_paths "
1584 << convert<string>(windows_style_tex_paths) << '\n';
1588 case RC_TEX_ALLOWS_SPACES:
1589 if (tex_allows_spaces != system_lyxrc.tex_allows_spaces) {
1590 os << "\\tex_allows_spaces "
1591 << convert<string>(tex_allows_spaces) << '\n';
1596 if (ignore_system_lyxrc ||
1597 use_kbmap != system_lyxrc.use_kbmap) {
1598 os << "\\kbmap " << convert<string>(use_kbmap) << '\n';
1602 case RC_KBMAP_PRIMARY:
1603 if (ignore_system_lyxrc ||
1604 primary_kbmap != system_lyxrc.primary_kbmap) {
1605 string const path = os::external_path(primary_kbmap);
1606 os << "\\kbmap_primary \"" << path << "\"\n";
1610 case RC_KBMAP_SECONDARY:
1611 if (ignore_system_lyxrc ||
1612 secondary_kbmap != system_lyxrc.secondary_kbmap) {
1613 string const path = os::external_path(secondary_kbmap);
1614 os << "\\kbmap_secondary \"" << path << "\"\n";
1619 if (ignore_system_lyxrc ||
1620 lyxpipes != system_lyxrc.lyxpipes) {
1621 string const path = os::external_path(lyxpipes);
1622 os << "\\serverpipe \"" << path << "\"\n";
1626 case RC_DATE_INSERT_FORMAT:
1627 if (ignore_system_lyxrc ||
1628 date_insert_format != system_lyxrc.date_insert_format) {
1629 os << "\\date_insert_format \"" << date_insert_format
1636 os << "\\user_name \"" << user_name << "\"\n";
1641 os << "\\user_email \"" << user_email << "\"\n";
1645 case RC_SHOW_BANNER:
1646 if (ignore_system_lyxrc ||
1647 show_banner != system_lyxrc.show_banner) {
1648 os << "\\show_banner " << convert<string>(show_banner) << '\n';
1654 if (ignore_system_lyxrc ||
1655 preview != system_lyxrc.preview) {
1661 case PREVIEW_NO_MATH:
1668 os << "\\preview " << status << '\n';
1673 case RC_PREVIEW_HASHED_LABELS:
1674 if (ignore_system_lyxrc ||
1675 preview_hashed_labels !=
1676 system_lyxrc.preview_hashed_labels) {
1677 os << "\\preview_hashed_labels "
1678 << convert<string>(preview_hashed_labels) << '\n';
1683 case RC_PREVIEW_SCALE_FACTOR:
1684 if (ignore_system_lyxrc ||
1685 preview_scale_factor != system_lyxrc.preview_scale_factor) {
1686 os << "\\preview_scale_factor "
1687 << preview_scale_factor << '\n';
1692 case RC_USE_CONVERTER_CACHE:
1693 if (ignore_system_lyxrc ||
1694 use_converter_cache != system_lyxrc.use_converter_cache) {
1695 os << "\\use_converter_cache "
1696 << convert<string>(use_converter_cache) << '\n';
1701 case RC_CONVERTER_CACHE_MAXAGE:
1702 if (ignore_system_lyxrc ||
1703 converter_cache_maxage != system_lyxrc.converter_cache_maxage) {
1704 os << "\\converter_cache_maxage "
1705 << converter_cache_maxage << '\n';
1711 << "# SCREEN & FONTS SECTION ############################\n"
1715 if (ignore_system_lyxrc ||
1716 icon_set != system_lyxrc.icon_set) {
1717 os << "\\icon_set \"" << icon_set
1723 case RC_USE_SYSTEM_THEME_ICONS:
1724 if (ignore_system_lyxrc ||
1725 use_system_theme_icons != system_lyxrc.use_system_theme_icons) {
1726 os << "\\use_system_theme_icons "
1727 << convert<string>(use_system_theme_icons)
1734 if (ignore_system_lyxrc ||
1735 dpi != system_lyxrc.dpi) {
1736 os << "\\screen_dpi " << dpi << '\n';
1740 case RC_SCREEN_ZOOM:
1741 if (ignore_system_lyxrc ||
1742 zoom != system_lyxrc.zoom) {
1743 os << "\\screen_zoom " << zoom << '\n';
1747 case RC_GEOMETRY_SESSION:
1748 if (ignore_system_lyxrc ||
1749 allow_geometry_session != system_lyxrc.allow_geometry_session) {
1750 os << "\\allow_geometry_session " << convert<string>(allow_geometry_session)
1755 case RC_CURSOR_FOLLOWS_SCROLLBAR:
1756 if (ignore_system_lyxrc ||
1757 cursor_follows_scrollbar
1758 != system_lyxrc.cursor_follows_scrollbar) {
1759 os << "\\cursor_follows_scrollbar "
1760 << convert<string>(cursor_follows_scrollbar) << '\n';
1764 case RC_CURSOR_WIDTH:
1765 if (ignore_system_lyxrc ||
1767 != system_lyxrc.cursor_width) {
1768 os << "\\cursor_width "
1769 << cursor_width << '\n';
1773 case RC_SCROLL_BELOW_DOCUMENT:
1774 if (ignore_system_lyxrc ||
1775 scroll_below_document
1776 != system_lyxrc.scroll_below_document) {
1777 os << "\\scroll_below_document "
1778 << convert<string>(scroll_below_document) << '\n';
1782 case RC_PARAGRAPH_MARKERS:
1783 if (ignore_system_lyxrc ||
1785 != system_lyxrc.paragraph_markers) {
1786 os << "\\paragraph_markers "
1787 << convert<string>(paragraph_markers) << '\n';
1791 case RC_MAC_DONTSWAP_CTRL_META:
1792 if (ignore_system_lyxrc ||
1793 mac_dontswap_ctrl_meta
1794 != system_lyxrc.mac_dontswap_ctrl_meta) {
1795 os << "\\mac_dontswap_ctrl_meta "
1796 << convert<string>(mac_dontswap_ctrl_meta) << '\n';
1800 case RC_MAC_LIKE_CURSOR_MOVEMENT:
1801 if (ignore_system_lyxrc ||
1802 mac_like_cursor_movement
1803 != system_lyxrc.mac_like_cursor_movement) {
1804 os << "\\mac_like_cursor_movement "
1805 << convert<string>(mac_like_cursor_movement) << '\n';
1809 case RC_MACRO_EDIT_STYLE:
1810 if (ignore_system_lyxrc ||
1812 != system_lyxrc.macro_edit_style) {
1813 os << "\\macro_edit_style ";
1814 switch (macro_edit_style) {
1815 case MACRO_EDIT_INLINE_BOX: os << "0\n"; break;
1816 case MACRO_EDIT_INLINE: os << "1\n"; break;
1817 case MACRO_EDIT_LIST: os << "2\n"; break;
1822 case RC_DIALOGS_ICONIFY_WITH_MAIN:
1823 if (ignore_system_lyxrc ||
1824 dialogs_iconify_with_main
1825 != system_lyxrc.dialogs_iconify_with_main) {
1826 os << "\\dialogs_iconify_with_main "
1827 << convert<string>(dialogs_iconify_with_main) << '\n';
1831 case RC_SCREEN_FONT_ROMAN:
1832 if (ignore_system_lyxrc ||
1833 roman_font_name != system_lyxrc.roman_font_name) {
1834 os << "\\screen_font_roman \"" << roman_font_name
1839 case RC_SCREEN_FONT_ROMAN_FOUNDRY:
1840 if (ignore_system_lyxrc ||
1841 roman_font_foundry != system_lyxrc.roman_font_foundry) {
1842 os << "\\screen_font_roman_foundry \"" << roman_font_foundry
1847 case RC_SCREEN_FONT_SANS:
1848 if (ignore_system_lyxrc ||
1849 sans_font_name != system_lyxrc.sans_font_name) {
1850 os << "\\screen_font_sans \"" << sans_font_name
1855 case RC_SCREEN_FONT_SANS_FOUNDRY:
1856 if (ignore_system_lyxrc ||
1857 sans_font_foundry != system_lyxrc.sans_font_foundry) {
1858 os << "\\screen_font_sans_foundry \"" << sans_font_foundry
1863 case RC_SCREEN_FONT_TYPEWRITER:
1864 if (ignore_system_lyxrc ||
1865 typewriter_font_name != system_lyxrc.typewriter_font_name) {
1866 os << "\\screen_font_typewriter \""
1867 << typewriter_font_name << "\"\n";
1871 case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
1872 if (ignore_system_lyxrc ||
1873 typewriter_font_foundry != system_lyxrc.typewriter_font_foundry) {
1874 os << "\\screen_font_typewriter_foundry \""
1875 << typewriter_font_foundry << "\"\n";
1880 case RC_SCREEN_FONT_SCALABLE:
1881 if (ignore_system_lyxrc ||
1882 use_scalable_fonts != system_lyxrc.use_scalable_fonts) {
1883 os << "\\screen_font_scalable "
1884 << convert<string>(use_scalable_fonts)
1889 case RC_SCREEN_FONT_SIZES:
1890 if (ignore_system_lyxrc ||
1891 font_sizes[FONT_SIZE_TINY]
1892 != system_lyxrc.font_sizes[FONT_SIZE_TINY] ||
1893 font_sizes[FONT_SIZE_SCRIPT]
1894 != system_lyxrc.font_sizes[FONT_SIZE_SCRIPT] ||
1895 font_sizes[FONT_SIZE_FOOTNOTE]
1896 != system_lyxrc.font_sizes[FONT_SIZE_FOOTNOTE] ||
1897 font_sizes[FONT_SIZE_SMALL]
1898 != system_lyxrc.font_sizes[FONT_SIZE_SMALL] ||
1899 font_sizes[FONT_SIZE_NORMAL]
1900 != system_lyxrc.font_sizes[FONT_SIZE_NORMAL] ||
1901 font_sizes[FONT_SIZE_LARGE]
1902 != system_lyxrc.font_sizes[FONT_SIZE_LARGE] ||
1903 font_sizes[FONT_SIZE_LARGER]
1904 != system_lyxrc.font_sizes[FONT_SIZE_LARGER] ||
1905 font_sizes[FONT_SIZE_LARGEST]
1906 != system_lyxrc.font_sizes[FONT_SIZE_LARGEST] ||
1907 font_sizes[FONT_SIZE_HUGE]
1908 != system_lyxrc.font_sizes[FONT_SIZE_HUGE] ||
1909 font_sizes[FONT_SIZE_HUGER]
1910 != system_lyxrc.font_sizes[FONT_SIZE_HUGER]) {
1911 os.setf(ios::fixed);
1913 os << "\\screen_font_sizes"
1914 << ' ' << font_sizes[FONT_SIZE_TINY]
1915 << ' ' << font_sizes[FONT_SIZE_SCRIPT]
1916 << ' ' << font_sizes[FONT_SIZE_FOOTNOTE]
1917 << ' ' << font_sizes[FONT_SIZE_SMALL]
1918 << ' ' << font_sizes[FONT_SIZE_NORMAL]
1919 << ' ' << font_sizes[FONT_SIZE_LARGE]
1920 << ' ' << font_sizes[FONT_SIZE_LARGER]
1921 << ' ' << font_sizes[FONT_SIZE_LARGEST]
1922 << ' ' << font_sizes[FONT_SIZE_HUGE]
1923 << ' ' << font_sizes[FONT_SIZE_HUGER]
1928 case RC_FULL_SCREEN_LIMIT:
1929 if (ignore_system_lyxrc ||
1930 full_screen_limit != system_lyxrc.full_screen_limit) {
1931 os << "\\fullscreen_limit "
1932 << convert<string>(full_screen_limit)
1937 case RC_FULL_SCREEN_TOOLBARS:
1938 if (ignore_system_lyxrc ||
1939 full_screen_toolbars != system_lyxrc.full_screen_toolbars) {
1940 os << "\\fullscreen_toolbars "
1941 << convert<string>(full_screen_toolbars)
1946 case RC_FULL_SCREEN_SCROLLBAR:
1947 if (ignore_system_lyxrc ||
1948 full_screen_scrollbar != system_lyxrc.full_screen_scrollbar) {
1949 os << "\\fullscreen_scrollbar "
1950 << convert<string>(full_screen_scrollbar)
1955 case RC_FULL_SCREEN_STATUSBAR:
1956 if (ignore_system_lyxrc ||
1957 full_screen_statusbar != system_lyxrc.full_screen_statusbar) {
1958 os << "\\fullscreen_statusbar "
1959 << convert<string>(full_screen_statusbar)
1964 case RC_FULL_SCREEN_TABBAR:
1965 if (ignore_system_lyxrc ||
1966 full_screen_tabbar != system_lyxrc.full_screen_tabbar) {
1967 os << "\\fullscreen_tabbar "
1968 << 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)
1982 case RC_FULL_SCREEN_WIDTH:
1983 if (ignore_system_lyxrc ||
1984 full_screen_width != system_lyxrc.full_screen_width) {
1985 os << "\\fullscreen_width "
1986 << convert<string>(full_screen_width)
1991 case RC_OPEN_BUFFERS_IN_TABS:
1992 if (ignore_system_lyxrc ||
1993 open_buffers_in_tabs != system_lyxrc.open_buffers_in_tabs) {
1994 os << "\\open_buffers_in_tabs "
1995 << convert<string>(open_buffers_in_tabs)
2000 case RC_SINGLE_CLOSE_TAB_BUTTON:
2001 if (ignore_system_lyxrc ||
2002 single_close_tab_button != system_lyxrc.single_close_tab_button) {
2003 os << "\\single_close_tab_button "
2004 << convert<string>(single_close_tab_button)
2009 case RC_SINGLE_INSTANCE:
2010 if (ignore_system_lyxrc ||
2011 single_instance != system_lyxrc.single_instance) {
2012 os << "\\single_instance "
2013 << convert<string>(single_instance)
2018 case RC_FORWARD_SEARCH_DVI:
2019 if (ignore_system_lyxrc ||
2020 forward_search_dvi != system_lyxrc.forward_search_dvi) {
2021 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"
2038 for (int i = 0; i < Color_ignore; ++i) {
2039 ColorCode lc = static_cast<ColorCode>(i);
2040 string const col = lcolor.getX11Name(lc);
2041 if (ignore_system_lyxrc
2042 || col != system_lcolor.getX11Name(lc)) {
2043 os << "\\set_color \""
2044 << lcolor.getLyXName(lc) << "\" \""
2052 << "# PRINTER SECTION ###################################\n"
2056 if (ignore_system_lyxrc ||
2057 printer != system_lyxrc.printer) {
2058 os << "\\printer \"" << printer << "\"\n";
2062 case RC_PRINT_ADAPTOUTPUT:
2063 if (ignore_system_lyxrc ||
2064 print_adapt_output != system_lyxrc.print_adapt_output) {
2065 os << "\\print_adapt_output "
2066 << convert<string>(print_adapt_output)
2071 case RC_PRINT_COMMAND:
2072 if (ignore_system_lyxrc ||
2073 print_command != system_lyxrc.print_command) {
2074 os << "\\print_command \"" << escapeCommand(print_command) << "\"\n";
2078 case RC_PRINTEXSTRAOPTIONS:
2079 if (ignore_system_lyxrc ||
2080 print_extra_options != system_lyxrc.print_extra_options) {
2081 os << "\\print_extra_options \"" << print_extra_options
2086 case RC_PRINTSPOOL_COMMAND:
2087 if (ignore_system_lyxrc ||
2088 print_spool_command != system_lyxrc.print_spool_command) {
2089 os << "\\print_spool_command \"" << escapeCommand(print_spool_command)
2094 case RC_PRINTSPOOL_PRINTERPREFIX:
2095 if (ignore_system_lyxrc ||
2096 print_spool_printerprefix
2097 != system_lyxrc.print_spool_printerprefix) {
2098 os << "\\print_spool_printerprefix \""
2099 << print_spool_printerprefix << "\"\n";
2103 case RC_PRINTEVENPAGEFLAG:
2104 if (ignore_system_lyxrc ||
2105 print_evenpage_flag != system_lyxrc.print_evenpage_flag) {
2106 os << "\\print_evenpage_flag \"" << print_evenpage_flag
2111 case RC_PRINTODDPAGEFLAG:
2112 if (ignore_system_lyxrc ||
2113 print_oddpage_flag != system_lyxrc.print_oddpage_flag) {
2114 os << "\\print_oddpage_flag \"" << print_oddpage_flag
2119 case RC_PRINTREVERSEFLAG:
2120 if (ignore_system_lyxrc ||
2121 print_reverse_flag != system_lyxrc.print_reverse_flag) {
2122 os << "\\print_reverse_flag \"" << print_reverse_flag
2127 case RC_PRINTLANDSCAPEFLAG:
2128 if (ignore_system_lyxrc ||
2129 print_landscape_flag != system_lyxrc.print_landscape_flag) {
2130 os << "\\print_landscape_flag \"" << print_landscape_flag
2135 case RC_PRINTPAGERANGEFLAG:
2136 if (ignore_system_lyxrc ||
2137 print_pagerange_flag != system_lyxrc.print_pagerange_flag) {
2138 os << "\\print_pagerange_flag \"" << print_pagerange_flag
2143 case RC_PRINTCOPIESFLAG:
2144 if (ignore_system_lyxrc ||
2145 print_copies_flag != system_lyxrc.print_copies_flag) {
2146 os << "\\print_copies_flag \"" << print_copies_flag
2151 case RC_PRINTCOLLCOPIESFLAG:
2152 if (ignore_system_lyxrc ||
2153 print_collcopies_flag
2154 != system_lyxrc.print_collcopies_flag) {
2155 os << "\\print_collcopies_flag \""
2156 << print_collcopies_flag
2161 case RC_PRINTPAPERFLAG:
2162 if (ignore_system_lyxrc ||
2163 print_paper_flag != system_lyxrc.print_paper_flag) {
2164 os << "\\print_paper_flag \"" << print_paper_flag
2169 case RC_PRINTPAPERDIMENSIONFLAG:
2170 if (ignore_system_lyxrc ||
2171 print_paper_dimension_flag
2172 != system_lyxrc.print_paper_dimension_flag) {
2173 os << "\\print_paper_dimension_flag \""
2174 << print_paper_dimension_flag << "\"\n";
2178 case RC_PRINTTOPRINTER:
2179 if (ignore_system_lyxrc ||
2180 print_to_printer != system_lyxrc.print_to_printer) {
2181 os << "\\print_to_printer \"" << print_to_printer
2186 case RC_PRINTTOFILE:
2187 if (ignore_system_lyxrc ||
2188 print_to_file != system_lyxrc.print_to_file) {
2189 string const path = os::external_path(print_to_file);
2190 os << "\\print_to_file \"" << path << "\"\n";
2194 case RC_PRINTFILEEXTENSION:
2195 if (ignore_system_lyxrc ||
2196 print_file_extension != system_lyxrc.print_file_extension) {
2197 os << "\\print_file_extension \""
2198 << print_file_extension
2205 << "# TEX SECTION #######################################\n"
2208 case RC_TEXINPUTS_PREFIX:
2209 if (ignore_system_lyxrc ||
2210 texinputs_prefix != system_lyxrc.texinputs_prefix) {
2211 os << "\\texinputs_prefix \"" << texinputs_prefix << "\"\n";
2216 case RC_FONT_ENCODING:
2217 if (ignore_system_lyxrc ||
2218 fontenc != system_lyxrc.fontenc) {
2219 os << "\\font_encoding \"" << fontenc << "\"\n";
2224 case RC_FORCE_PAINT_SINGLE_CHAR:
2225 if (ignore_system_lyxrc ||
2226 force_paint_single_char != system_lyxrc.force_paint_single_char) {
2227 os << "\\force_paint_single_char \"" << force_paint_single_char << "\"\n";
2233 << "# FILE SECTION ######################################\n"
2236 case RC_DOCUMENTPATH:
2237 if (ignore_system_lyxrc ||
2238 document_path != system_lyxrc.document_path) {
2239 string const path = os::external_path(document_path);
2240 os << "\\document_path \"" << path << "\"\n";
2244 case RC_USELASTFILEPOS:
2245 if (ignore_system_lyxrc ||
2246 use_lastfilepos != system_lyxrc.use_lastfilepos) {
2247 os << "\\use_lastfilepos " << convert<string>(use_lastfilepos)
2252 case RC_LOADSESSION:
2253 if (ignore_system_lyxrc ||
2254 load_session != system_lyxrc.load_session) {
2255 os << "\\load_session " << convert<string>(load_session)
2260 case RC_MOUSE_WHEEL_SPEED:
2261 if (ignore_system_lyxrc ||
2262 mouse_wheel_speed != system_lyxrc.mouse_wheel_speed) {
2263 os << "\\mouse_wheel_speed " << mouse_wheel_speed << '\n';
2267 case RC_COMPLETION_INLINE_DELAY:
2268 if (ignore_system_lyxrc ||
2269 completion_inline_delay != system_lyxrc.completion_inline_delay) {
2270 os << "\\completion_inline_delay " << completion_inline_delay << '\n';
2274 case RC_COMPLETION_INLINE_MATH:
2275 if (ignore_system_lyxrc ||
2276 completion_inline_math != system_lyxrc.completion_inline_math) {
2277 os << "\\completion_inline_math "
2278 << convert<string>(completion_inline_math) << '\n';
2282 case RC_COMPLETION_INLINE_TEXT:
2283 if (ignore_system_lyxrc ||
2284 completion_inline_text != system_lyxrc.completion_inline_text) {
2285 os << "\\completion_inline_text "
2286 << convert<string>(completion_inline_text) << '\n';
2290 case RC_COMPLETION_INLINE_DOTS:
2291 if (ignore_system_lyxrc ||
2292 completion_inline_dots != system_lyxrc.completion_inline_dots) {
2293 os << "\\completion_inline_dots "
2294 << convert<string>(completion_inline_dots) << '\n';
2298 case RC_AUTOCORRECTION_MATH:
2299 if (ignore_system_lyxrc ||
2300 autocorrection_math != system_lyxrc.autocorrection_math) {
2301 os << "\\autocorrection_math "
2302 << convert<string>(autocorrection_math) << '\n';
2306 case RC_COMPLETION_POPUP_DELAY:
2307 if (ignore_system_lyxrc ||
2308 completion_popup_delay != system_lyxrc.completion_popup_delay) {
2309 os << "\\completion_popup_delay " << completion_popup_delay << '\n';
2313 case RC_COMPLETION_POPUP_MATH:
2314 if (ignore_system_lyxrc ||
2315 completion_popup_math != system_lyxrc.completion_popup_math) {
2316 os << "\\completion_popup_math "
2317 << convert<string>(completion_popup_math) << '\n';
2321 case RC_COMPLETION_POPUP_TEXT:
2322 if (ignore_system_lyxrc ||
2323 completion_popup_text != system_lyxrc.completion_popup_text) {
2324 os << "\\completion_popup_text "
2325 << convert<string>(completion_popup_text) << '\n';
2329 case RC_COMPLETION_CURSOR_TEXT:
2330 if (ignore_system_lyxrc ||
2331 completion_cursor_text != system_lyxrc.completion_cursor_text) {
2332 os << "\\completion_cursor_text "
2333 << convert<string>(completion_cursor_text) << '\n';
2337 case RC_COMPLETION_POPUP_AFTER_COMPLETE:
2338 if (ignore_system_lyxrc ||
2339 completion_popup_after_complete
2340 != system_lyxrc.completion_popup_after_complete) {
2341 os << "\\completion_popup_after_complete "
2342 << convert<string>(completion_popup_after_complete) << '\n';
2346 case RC_COMPLETION_MINLENGTH:
2347 if (ignore_system_lyxrc ||
2348 completion_minlength != system_lyxrc.completion_minlength) {
2349 os << "\\completion_minlength " << convert<string>(completion_minlength)
2355 case RC_NUMLASTFILES:
2356 if (ignore_system_lyxrc ||
2357 num_lastfiles != system_lyxrc.num_lastfiles) {
2358 os << "\\num_lastfiles " << num_lastfiles << '\n';
2362 case RC_CHECKLASTFILES:
2363 if (ignore_system_lyxrc ||
2364 check_lastfiles != system_lyxrc.check_lastfiles) {
2365 os << "\\check_lastfiles " << convert<string>(check_lastfiles)
2370 case RC_EXAMPLEPATH:
2371 if (ignore_system_lyxrc ||
2372 example_path != system_lyxrc.example_path) {
2373 string const path = os::external_path(example_path);
2374 os << "\\example_path \"" << path << "\"\n";
2378 case RC_TEMPLATEPATH:
2379 if (ignore_system_lyxrc ||
2380 template_path != system_lyxrc.template_path) {
2381 string const path = os::external_path(template_path);
2382 os << "\\template_path \"" << path << "\"\n";
2386 case RC_TEMPDIRPATH:
2387 if (ignore_system_lyxrc ||
2388 tempdir_path != system_lyxrc.tempdir_path) {
2389 string const path = os::external_path(tempdir_path);
2390 os << "\\tempdir_path \"" << path << "\"\n";
2394 case RC_THESAURUSDIRPATH:
2395 if (ignore_system_lyxrc ||
2396 thesaurusdir_path != system_lyxrc.thesaurusdir_path) {
2397 string const path = os::external_path(thesaurusdir_path);
2398 os << "\\thesaurusdir_path \"" << path << "\"\n";
2402 case RC_HUNSPELLDIR_PATH:
2403 if (ignore_system_lyxrc ||
2404 hunspelldir_path != system_lyxrc.hunspelldir_path) {
2405 string const path = os::external_path(hunspelldir_path);
2406 os << "\\hunspelldir_path \"" << path << "\"\n";
2410 case RC_PLAINTEXT_LINELEN:
2411 if (ignore_system_lyxrc ||
2412 plaintext_linelen != system_lyxrc.plaintext_linelen) {
2413 os << "\\plaintext_linelen " << plaintext_linelen << '\n';
2417 case RC_MAKE_BACKUP:
2418 if (ignore_system_lyxrc ||
2419 make_backup != system_lyxrc.make_backup) {
2420 os << "\\make_backup " << convert<string>(make_backup) << '\n';
2424 case RC_SAVE_COMPRESSED:
2425 if (ignore_system_lyxrc ||
2426 save_compressed != system_lyxrc.save_compressed) {
2427 os << "\\save_compressed " << convert<string>(save_compressed) << '\n';
2431 case RC_BACKUPDIR_PATH:
2432 if (ignore_system_lyxrc ||
2433 backupdir_path != system_lyxrc.backupdir_path) {
2434 string const path = os::external_path(backupdir_path);
2435 os << "\\backupdir_path \"" << path << "\"\n";
2441 << "# PLAIN TEXT EXPORT SECTION ##############################\n"
2445 << "# SPELLCHECKER SECTION ##############################\n"
2448 case RC_ACCEPT_COMPOUND:
2449 if (ignore_system_lyxrc ||
2450 spellchecker_accept_compound != system_lyxrc.spellchecker_accept_compound) {
2451 os << "\\accept_compound " << convert<string>(spellchecker_accept_compound)
2457 if (ignore_system_lyxrc ||
2458 spellchecker_alt_lang != system_lyxrc.spellchecker_alt_lang) {
2459 os << "\\alternate_language \"" << spellchecker_alt_lang
2465 if (ignore_system_lyxrc ||
2466 spellchecker_esc_chars != system_lyxrc.spellchecker_esc_chars) {
2467 os << "\\escape_chars \"" << spellchecker_esc_chars << "\"\n";
2471 case RC_USE_SYSTEM_COLORS:
2472 if (ignore_system_lyxrc ||
2473 use_system_colors != system_lyxrc.use_system_colors) {
2474 os << "\\use_system_colors "
2475 << convert<string>(use_system_colors)
2480 case RC_USE_TOOLTIP:
2481 if (ignore_system_lyxrc ||
2482 use_tooltip != system_lyxrc.use_tooltip) {
2483 os << "\\use_tooltip "
2484 << convert<string>(use_tooltip)
2489 case RC_USE_PIXMAP_CACHE:
2490 if (ignore_system_lyxrc ||
2491 use_pixmap_cache != system_lyxrc.use_pixmap_cache) {
2492 os << "\\use_pixmap_cache "
2493 << convert<string>(use_pixmap_cache)
2499 if (ignore_system_lyxrc ||
2500 use_qimage != system_lyxrc.use_qimage) {
2501 os << "\\use_qimage "
2502 << convert<string>(use_qimage)
2509 << "# LANGUAGE SUPPORT SECTION ##########################\n"
2514 case RC_DEFAULT_DECIMAL_POINT:
2515 if (ignore_system_lyxrc ||
2516 default_decimal_point != system_lyxrc.default_decimal_point) {
2517 os << "\\default_decimal_point " << default_decimal_point << '\n';
2522 case RC_DEFAULT_LENGTH_UNIT:
2523 if (ignore_system_lyxrc ||
2524 default_length_unit != system_lyxrc.default_length_unit) {
2525 os << "\\default_length_unit " << int(default_length_unit) << '\n';
2530 case RC_SPELLCHECKER:
2531 if (ignore_system_lyxrc ||
2532 spellchecker != system_lyxrc.spellchecker) {
2533 os << "\\spellchecker " << spellchecker << '\n';
2538 case RC_SPELLCHECK_CONTINUOUSLY:
2539 if (ignore_system_lyxrc ||
2540 spellcheck_continuously != system_lyxrc.spellcheck_continuously) {
2541 os << "\\spellcheck_continuously " << convert<string>(spellcheck_continuously)
2547 case RC_SPELLCHECK_NOTES:
2548 if (ignore_system_lyxrc ||
2549 spellcheck_notes != system_lyxrc.spellcheck_notes) {
2550 os << "\\spellcheck_notes " << convert<string>(spellcheck_notes)
2556 case RC_RTL_SUPPORT:
2557 if (ignore_system_lyxrc ||
2558 rtl_support != system_lyxrc.rtl_support) {
2559 os << "\\rtl " << convert<string>(rtl_support) << '\n';
2563 case RC_VISUAL_CURSOR:
2564 if (ignore_system_lyxrc ||
2565 visual_cursor != system_lyxrc.visual_cursor) {
2566 os << "\\visual_cursor " << convert<string>(visual_cursor) << '\n';
2570 case RC_CLOSE_BUFFER_WITH_LAST_VIEW:
2571 if (ignore_system_lyxrc ||
2572 close_buffer_with_last_view != system_lyxrc.close_buffer_with_last_view) {
2573 os << "# When closing last view, buffer closes (yes), hides (no), or ask the user (ask)\n";
2574 os << "\\close_buffer_with_last_view " << close_buffer_with_last_view << '\n';
2578 case RC_LANGUAGE_CUSTOM_PACKAGE:
2579 if (ignore_system_lyxrc ||
2580 language_custom_package != system_lyxrc.language_custom_package) {
2581 os << "\\language_custom_package \"" << language_custom_package
2586 case RC_LANGUAGE_GLOBAL_OPTIONS:
2587 if (ignore_system_lyxrc ||
2588 language_global_options
2589 != system_lyxrc.language_global_options) {
2590 os << "\\language_global_options \""
2591 << convert<string>(language_global_options)
2596 case RC_LANGUAGE_PACKAGE_SELECTION:
2597 if (ignore_system_lyxrc ||
2598 language_package_selection != system_lyxrc.language_package_selection) {
2599 os << "\\language_package_selection ";
2600 switch (language_package_selection) {
2617 case RC_LANGUAGE_COMMAND_BEGIN:
2618 if (ignore_system_lyxrc ||
2619 language_command_begin
2620 != system_lyxrc.language_command_begin) {
2621 os << "\\language_command_begin \""
2622 << language_command_begin
2627 case RC_LANGUAGE_COMMAND_END:
2628 if (ignore_system_lyxrc ||
2629 language_command_end
2630 != system_lyxrc.language_command_end) {
2631 os << "\\language_command_end \"" << language_command_end
2636 case RC_LANGUAGE_COMMAND_LOCAL:
2637 if (ignore_system_lyxrc ||
2638 language_command_local
2639 != system_lyxrc.language_command_local) {
2640 os << "\\language_command_local \""
2641 << language_command_local
2646 case RC_LANGUAGE_AUTO_BEGIN:
2647 if (ignore_system_lyxrc ||
2648 language_auto_begin != system_lyxrc.language_auto_begin) {
2649 os << "\\language_auto_begin "
2650 << convert<string>(language_auto_begin) << '\n';
2654 case RC_LANGUAGE_AUTO_END:
2655 if (ignore_system_lyxrc ||
2656 language_auto_end != system_lyxrc.language_auto_end) {
2657 os << "\\language_auto_end "
2658 << convert<string>(language_auto_end) << '\n';
2662 case RC_MARK_FOREIGN_LANGUAGE:
2663 if (ignore_system_lyxrc ||
2664 mark_foreign_language
2665 != system_lyxrc.mark_foreign_language) {
2666 os << "\\mark_foreign_language " <<
2667 convert<string>(mark_foreign_language) << '\n';
2673 << "# 2nd MISC SUPPORT SECTION ##########################\n"
2676 case RC_AUTO_NUMBER:
2677 if (ignore_system_lyxrc ||
2678 auto_number != system_lyxrc.auto_number) {
2679 os << "\\auto_number " << convert<string>(auto_number) << '\n';
2683 case RC_GUI_LANGUAGE:
2684 if (ignore_system_lyxrc ||
2685 gui_language != system_lyxrc.gui_language) {
2686 os << "\\gui_language " << gui_language << '\n';
2690 case RC_EXPORT_OVERWRITE:
2691 if (ignore_system_lyxrc ||
2692 export_overwrite != system_lyxrc.export_overwrite) {
2694 switch (export_overwrite) {
2705 os << "\\export_overwrite " << status << '\n';
2710 case RC_SCROLL_WHEEL_ZOOM:
2711 if (ignore_system_lyxrc ||
2712 scroll_wheel_zoom != system_lyxrc.scroll_wheel_zoom) {
2714 switch (scroll_wheel_zoom) {
2715 case SCROLL_WHEEL_ZOOM_OFF:
2718 case SCROLL_WHEEL_ZOOM_CTRL:
2721 case SCROLL_WHEEL_ZOOM_SHIFT:
2724 case SCROLL_WHEEL_ZOOM_ALT:
2728 os << "\\scroll_wheel_zoom " << status << '\n';
2734 << "# FORMATS SECTION ##########################\n"
2738 // New/modified formats
2739 for (Formats::const_iterator cit = formats.begin();
2740 cit != formats.end(); ++cit) {
2741 Format const * format =
2742 system_formats.getFormat(cit->name());
2744 format->extensions() != cit->extensions() ||
2745 format->prettyname() != cit->prettyname() ||
2746 format->shortcut() != cit->shortcut() ||
2747 format->viewer() != cit->viewer() ||
2748 format->editor() != cit->editor() ||
2749 format->documentFormat() != cit->documentFormat() ||
2750 format->vectorFormat() != cit->vectorFormat() ||
2751 format->inExportMenu() != cit->inExportMenu() ||
2752 format->mime() != cit->mime()) {
2753 os << "\\format \"" << cit->name() << "\" \""
2754 << cit->extensions() << "\" \""
2755 << cit->prettyname() << "\" \""
2756 << cit->shortcut() << "\" \""
2757 << escapeCommand(cit->viewer()) << "\" \""
2758 << escapeCommand(cit->editor()) << "\" \"";
2759 vector<string> flags;
2760 if (cit->documentFormat())
2761 flags.push_back("document");
2762 if (cit->vectorFormat())
2763 flags.push_back("vector");
2764 if (cit->zippedNative())
2765 flags.push_back("zipped=native");
2766 if (cit->inExportMenu())
2767 flags.push_back("menu=export");
2769 os << getStringFromVector(flags);
2770 os << "\" \"" << cit->mime() << "\"\n";
2774 // Look for deleted formats
2775 for (Formats::const_iterator cit = system_formats.begin();
2776 cit != system_formats.end(); ++cit)
2777 if (!formats.getFormat(cit->name()))
2778 os << "\\format \"" << cit->name()
2779 << "\" \"\" \"\" \"\" \"\" \"\" \"\" \"\"\n";
2782 case RC_VIEWER_ALTERNATIVES: {
2783 Alternatives::const_iterator it = viewer_alternatives.begin();
2784 Alternatives::const_iterator const en = viewer_alternatives.end();
2785 Alternatives::const_iterator const sysend =
2786 system_lyxrc.viewer_alternatives.end();
2787 for (; it != en; ++it) {
2788 string const & fmt = it->first;
2789 CommandSet const & cmd = it->second;
2790 CommandSet::const_iterator sit = cmd.begin();
2791 CommandSet::const_iterator const sen = cmd.end();
2792 Alternatives::const_iterator const sysfmt = ignore_system_lyxrc ?
2793 system_lyxrc.viewer_alternatives.begin() : // we won't use it in this case
2794 system_lyxrc.viewer_alternatives.find(fmt);
2795 for (; sit != sen; ++sit) {
2796 string const & cmd = *sit;
2797 if (ignore_system_lyxrc
2798 || sysfmt == sysend // format not found
2799 || sysfmt->second.count(cmd) == 0 // this command not found
2801 os << "\\viewer_alternatives " << fmt << " \"" << escapeCommand(cmd) << "\"\n";
2807 case RC_EDITOR_ALTERNATIVES: {
2808 Alternatives::const_iterator it = editor_alternatives.begin();
2809 Alternatives::const_iterator const en = editor_alternatives.end();
2810 Alternatives::const_iterator const sysend =
2811 system_lyxrc.editor_alternatives.end();
2812 for (; it != en; ++it) {
2813 string const & fmt = it->first;
2814 CommandSet const & cmd = it->second;
2815 CommandSet::const_iterator sit = cmd.begin();
2816 CommandSet::const_iterator const sen = cmd.end();
2817 Alternatives::const_iterator const sysfmt = ignore_system_lyxrc ?
2818 system_lyxrc.editor_alternatives.begin() : // we won't use it in this case
2819 system_lyxrc.editor_alternatives.find(fmt);
2820 for (; sit != sen; ++sit) {
2821 string const & cmd = *sit;
2822 if (ignore_system_lyxrc
2823 || sysfmt == sysend // format not found
2824 || sysfmt->second.count(cmd) == 0 // this command not found
2826 os << "\\editor_alternatives " << fmt << " \"" << escapeCommand(cmd) << "\"\n";
2832 case RC_DEFAULT_OTF_VIEW_FORMAT:
2833 if ((ignore_system_lyxrc ||
2834 default_otf_view_format != system_lyxrc.default_otf_view_format)
2835 && !default_otf_view_format.empty()) {
2836 os << "\\default_otf_view_format " << default_otf_view_format << '\n';
2840 case RC_DEFAULT_VIEW_FORMAT:
2841 if (ignore_system_lyxrc ||
2842 default_view_format != system_lyxrc.default_view_format) {
2843 os << "\\default_view_format " << default_view_format << '\n';
2853 << "# CONVERTERS SECTION ##########################\n"
2857 // Look for new converters
2858 for (Converters::const_iterator cit = theConverters().begin();
2859 cit != theConverters().end(); ++cit) {
2860 Converter const * converter =
2861 theSystemConverters().getConverter(cit->from,
2864 converter->command != cit->command ||
2865 converter->flags != cit->flags)
2866 os << "\\converter \"" << cit->from << "\" \""
2867 << cit->to << "\" \""
2868 << escapeCommand(cit->command) << "\" \""
2869 << cit->flags << "\"\n";
2872 // New/modifed converters
2873 for (Converters::const_iterator cit = theSystemConverters().begin();
2874 cit != theSystemConverters().end(); ++cit)
2875 if (!theConverters().getConverter(cit->from, cit->to))
2876 os << "\\converter \"" << cit->from
2877 << "\" \"" << cit->to << "\" \"\" \"\"\n";
2884 << "# COPIERS SECTION ##########################\n"
2887 // Look for new movers
2888 Movers::const_iterator const sysbegin = theSystemMovers().begin();
2889 Movers::const_iterator const sysend = theSystemMovers().end();
2890 Movers::const_iterator it = theMovers().begin();
2891 Movers::const_iterator end = theMovers().end();
2893 for (; it != end; ++it) {
2894 Movers::const_iterator const sysit =
2895 find_if(sysbegin, sysend, SameMover(*it));
2896 if (sysit == sysend) {
2897 string const & fmt = it->first;
2898 string const & command =
2899 it->second.command();
2901 os << "\\copier " << fmt
2902 << " \"" << escapeCommand(command) << "\"\n";
2908 // We don't actually delete SpecialisedMover(s) from the
2909 // map, just clear their 'command', so there's no need
2910 // to test for anything else.
2917 void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new)
2919 // Why the switch you might ask. It is a trick to ensure that all
2920 // the elements in the LyXRCTags enum is handled. As you can see
2921 // there are no breaks at all. So it is just a huge fall-through.
2922 // The nice thing is that we will get a warning from the compiler
2923 // if we forget an element.
2924 LyXRC::LyXRCTags tag = LyXRC::RC_LAST;
2926 case LyXRC::RC_LAST:
2927 case LyXRC::RC_ACCEPT_COMPOUND:
2928 if (lyxrc_orig.spellchecker_accept_compound != lyxrc_new.spellchecker_accept_compound)
2929 if (theSpellChecker()) theSpellChecker()->advanceChangeNumber();
2930 case LyXRC::RC_ALT_LANG:
2931 case LyXRC::RC_PLAINTEXT_LINELEN:
2932 case LyXRC::RC_AUTOCORRECTION_MATH:
2933 case LyXRC::RC_AUTOREGIONDELETE:
2934 case LyXRC::RC_AUTORESET_OPTIONS:
2935 case LyXRC::RC_AUTOSAVE:
2936 case LyXRC::RC_AUTO_NUMBER:
2937 case LyXRC::RC_BACKUPDIR_PATH:
2938 case LyXRC::RC_BIBTEX_ALTERNATIVES:
2939 case LyXRC::RC_BIBTEX_COMMAND:
2940 case LyXRC::RC_BINDFILE:
2941 case LyXRC::RC_CHECKLASTFILES:
2942 case LyXRC::RC_COMPLETION_CURSOR_TEXT:
2943 case LyXRC::RC_COMPLETION_INLINE_DELAY:
2944 case LyXRC::RC_COMPLETION_INLINE_DOTS:
2945 case LyXRC::RC_COMPLETION_INLINE_MATH:
2946 case LyXRC::RC_COMPLETION_INLINE_TEXT:
2947 case LyXRC::RC_COMPLETION_POPUP_AFTER_COMPLETE:
2948 case LyXRC::RC_COMPLETION_POPUP_DELAY:
2949 case LyXRC::RC_COMPLETION_POPUP_MATH:
2950 case LyXRC::RC_COMPLETION_POPUP_TEXT:
2951 case LyXRC::RC_COMPLETION_MINLENGTH:
2952 case LyXRC::RC_USELASTFILEPOS:
2953 case LyXRC::RC_LOADSESSION:
2954 case LyXRC::RC_CHKTEX_COMMAND:
2955 case LyXRC::RC_CONVERTER:
2956 case LyXRC::RC_CONVERTER_CACHE_MAXAGE:
2957 case LyXRC::RC_COPIER:
2958 case LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR:
2959 case LyXRC::RC_SCROLL_BELOW_DOCUMENT:
2960 case LyXRC::RC_DATE_INSERT_FORMAT:
2961 case LyXRC::RC_GUI_LANGUAGE:
2962 case LyXRC::RC_DEFAULT_OTF_VIEW_FORMAT:
2963 case LyXRC::RC_DEFAULT_VIEW_FORMAT:
2964 case LyXRC::RC_DEFFILE:
2965 case LyXRC::RC_DIALOGS_ICONIFY_WITH_MAIN:
2966 case LyXRC::RC_DISPLAY_GRAPHICS:
2967 case LyXRC::RC_DOCUMENTPATH:
2968 if (lyxrc_orig.document_path != lyxrc_new.document_path) {
2969 FileName path(lyxrc_new.document_path);
2970 if (path.exists() && path.isDirectory())
2971 package().document_dir() = FileName(lyxrc.document_path);
2973 case LyXRC::RC_EDITOR_ALTERNATIVES:
2974 case LyXRC::RC_ESC_CHARS:
2975 case LyXRC::RC_EXAMPLEPATH:
2976 case LyXRC::RC_FONT_ENCODING:
2977 case LyXRC::RC_FORCE_PAINT_SINGLE_CHAR:
2978 case LyXRC::RC_FILEFORMAT:
2979 case LyXRC::RC_GROUP_LAYOUTS:
2980 case LyXRC::RC_HUNSPELLDIR_PATH:
2981 case LyXRC::RC_ICON_SET:
2982 case LyXRC::RC_INDEX_ALTERNATIVES:
2983 case LyXRC::RC_INDEX_COMMAND:
2984 case LyXRC::RC_JBIBTEX_COMMAND:
2985 case LyXRC::RC_JINDEX_COMMAND:
2986 case LyXRC::RC_NOMENCL_COMMAND:
2987 case LyXRC::RC_INPUT:
2988 case LyXRC::RC_KBMAP:
2989 case LyXRC::RC_KBMAP_PRIMARY:
2990 case LyXRC::RC_KBMAP_SECONDARY:
2991 case LyXRC::RC_LANGUAGE_AUTO_BEGIN:
2992 case LyXRC::RC_LANGUAGE_AUTO_END:
2993 case LyXRC::RC_LANGUAGE_COMMAND_BEGIN:
2994 case LyXRC::RC_LANGUAGE_COMMAND_END:
2995 case LyXRC::RC_LANGUAGE_COMMAND_LOCAL:
2996 case LyXRC::RC_LANGUAGE_GLOBAL_OPTIONS:
2997 case LyXRC::RC_LANGUAGE_CUSTOM_PACKAGE:
2998 case LyXRC::RC_LANGUAGE_PACKAGE_SELECTION:
2999 case LyXRC::RC_LYXRCFORMAT:
3000 case LyXRC::RC_MAC_DONTSWAP_CTRL_META:
3001 case LyXRC::RC_MAC_LIKE_CURSOR_MOVEMENT:
3002 case LyXRC::RC_MACRO_EDIT_STYLE:
3003 case LyXRC::RC_MAKE_BACKUP:
3004 case LyXRC::RC_MARK_FOREIGN_LANGUAGE:
3005 case LyXRC::RC_MOUSE_WHEEL_SPEED:
3006 case LyXRC::RC_NUMLASTFILES:
3007 case LyXRC::RC_PARAGRAPH_MARKERS:
3008 case LyXRC::RC_PATH_PREFIX:
3009 if (lyxrc_orig.path_prefix != lyxrc_new.path_prefix) {
3010 prependEnvPath("PATH", lyxrc_new.path_prefix);
3011 // Resets python path
3012 support::os::python(true);
3014 case LyXRC::RC_PREVIEW:
3015 case LyXRC::RC_PREVIEW_HASHED_LABELS:
3016 case LyXRC::RC_PREVIEW_SCALE_FACTOR:
3017 case LyXRC::RC_PRINTCOLLCOPIESFLAG:
3018 case LyXRC::RC_PRINTCOPIESFLAG:
3019 case LyXRC::RC_PRINTER:
3020 case LyXRC::RC_PRINTEVENPAGEFLAG:
3021 case LyXRC::RC_PRINTEXSTRAOPTIONS:
3022 case LyXRC::RC_PRINTFILEEXTENSION:
3023 case LyXRC::RC_PRINTLANDSCAPEFLAG:
3024 case LyXRC::RC_PRINTODDPAGEFLAG:
3025 case LyXRC::RC_PRINTPAGERANGEFLAG:
3026 case LyXRC::RC_PRINTPAPERDIMENSIONFLAG:
3027 case LyXRC::RC_PRINTPAPERFLAG:
3028 case LyXRC::RC_PRINTREVERSEFLAG:
3029 case LyXRC::RC_PRINTSPOOL_COMMAND:
3030 case LyXRC::RC_PRINTSPOOL_PRINTERPREFIX:
3031 case LyXRC::RC_PRINTTOFILE:
3032 case LyXRC::RC_PRINTTOPRINTER:
3033 case LyXRC::RC_PRINT_ADAPTOUTPUT:
3034 case LyXRC::RC_PRINT_COMMAND:
3035 case LyXRC::RC_RTL_SUPPORT:
3036 case LyXRC::RC_SAVE_COMPRESSED:
3037 case LyXRC::RC_SCREEN_DPI:
3038 case LyXRC::RC_SCREEN_FONT_ROMAN:
3039 case LyXRC::RC_SCREEN_FONT_ROMAN_FOUNDRY:
3040 case LyXRC::RC_SCREEN_FONT_SANS:
3041 case LyXRC::RC_SCREEN_FONT_SANS_FOUNDRY:
3042 case LyXRC::RC_SCREEN_FONT_SCALABLE:
3043 case LyXRC::RC_SCREEN_FONT_SIZES:
3044 case LyXRC::RC_SCREEN_FONT_TYPEWRITER:
3045 case LyXRC::RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
3046 case LyXRC::RC_GEOMETRY_SESSION:
3047 case LyXRC::RC_SCREEN_ZOOM:
3048 case LyXRC::RC_SERVERPIPE:
3049 case LyXRC::RC_SET_COLOR:
3050 case LyXRC::RC_SHOW_BANNER:
3051 case LyXRC::RC_OPEN_BUFFERS_IN_TABS:
3052 case LyXRC::RC_SPELLCHECKER:
3053 if (lyxrc_orig.spellchecker != lyxrc_new.spellchecker)
3055 case LyXRC::RC_SPELLCHECK_CONTINUOUSLY:
3056 case LyXRC::RC_SPELLCHECK_NOTES:
3057 case LyXRC::RC_SPLITINDEX_COMMAND:
3058 case LyXRC::RC_TEMPDIRPATH:
3059 case LyXRC::RC_TEMPLATEPATH:
3060 case LyXRC::RC_TEX_ALLOWS_SPACES:
3061 case LyXRC::RC_TEX_EXPECTS_WINDOWS_PATHS:
3062 if (lyxrc_orig.windows_style_tex_paths != lyxrc_new.windows_style_tex_paths) {
3063 os::windows_style_tex_paths(lyxrc_new.windows_style_tex_paths);
3065 case LyXRC::RC_TEXINPUTS_PREFIX:
3066 case LyXRC::RC_THESAURUSDIRPATH:
3067 case LyXRC::RC_UIFILE:
3068 case LyXRC::RC_USER_EMAIL:
3069 case LyXRC::RC_USER_NAME:
3070 case LyXRC::RC_USE_CONVERTER_CACHE:
3071 case LyXRC::RC_USE_SYSTEM_COLORS:
3072 case LyXRC::RC_USE_TOOLTIP:
3073 case LyXRC::RC_USE_PIXMAP_CACHE:
3074 case LyXRC::RC_USE_QIMAGE:
3075 case LyXRC::RC_USE_SYSTEM_THEME_ICONS:
3076 case LyXRC::RC_VIEWDVI_PAPEROPTION:
3077 case LyXRC::RC_SINGLE_CLOSE_TAB_BUTTON:
3078 case LyXRC::RC_SINGLE_INSTANCE:
3079 case LyXRC::RC_SORT_LAYOUTS:
3080 case LyXRC::RC_FULL_SCREEN_LIMIT:
3081 case LyXRC::RC_FULL_SCREEN_SCROLLBAR:
3082 case LyXRC::RC_FULL_SCREEN_MENUBAR:
3083 case LyXRC::RC_FULL_SCREEN_STATUSBAR:
3084 case LyXRC::RC_FULL_SCREEN_TABBAR:
3085 case LyXRC::RC_FULL_SCREEN_TOOLBARS:
3086 case LyXRC::RC_FULL_SCREEN_WIDTH:
3087 case LyXRC::RC_VISUAL_CURSOR:
3088 case LyXRC::RC_CLOSE_BUFFER_WITH_LAST_VIEW:
3089 case LyXRC::RC_VIEWER:
3090 case LyXRC::RC_VIEWER_ALTERNATIVES:
3091 case LyXRC::RC_FORWARD_SEARCH_DVI:
3092 case LyXRC::RC_FORWARD_SEARCH_PDF:
3093 case LyXRC::RC_EXPORT_OVERWRITE:
3094 case LyXRC::RC_DEFAULT_DECIMAL_POINT:
3095 case LyXRC::RC_DEFAULT_LENGTH_UNIT:
3096 case LyXRC::RC_SCROLL_WHEEL_ZOOM:
3097 case LyXRC::RC_CURSOR_WIDTH:
3104 string const LyXRC::getDescription(LyXRCTags tag)
3109 case RC_ACCEPT_COMPOUND:
3110 str = _("Consider run-together words, such as \"diskdrive\" for \"disk drive\", as legal words?");
3114 str = _("Specify an alternate language. The default is to use the language of the document.");
3117 case RC_PLAINTEXT_LINELEN:
3118 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.");
3121 case RC_AUTOREGIONDELETE:
3122 str = _("De-select if you don't want the current selection to be replaced automatically by what you type.");
3125 case RC_AUTORESET_OPTIONS:
3126 str = _("De-select if you don't want the class options to be reset to defaults after class change.");
3130 str = _("The time interval between auto-saves (in seconds). 0 means no auto-save.");
3133 case RC_AUTO_NUMBER:
3136 case RC_BACKUPDIR_PATH:
3137 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.");
3140 case RC_BIBTEX_COMMAND:
3141 str = _("Define the options of bibtex (cf. man bibtex) or select an alternative compiler (e.g. mlbibtex or bibulus).");
3144 case RC_JBIBTEX_COMMAND:
3145 str = _("Define the options of the bibtex program for PLaTeX (Japanese LaTeX).");
3149 str = _("Keybindings file. Can either specify an absolute path, or LyX will look in its global and local bind/ directories.");
3152 case RC_CHECKLASTFILES:
3153 str = _("Select to check whether the lastfiles still exist.");
3156 case RC_CHKTEX_COMMAND:
3157 str = _("Define how to run chktex. E.g. \"chktex -n11 -n1 -n3 -n6 -n9 -22 -n25 -n30 -n38\" Refer to the ChkTeX documentation.");
3166 case RC_CURSOR_FOLLOWS_SCROLLBAR:
3167 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.");
3170 case RC_CURSOR_WIDTH:
3171 str = _("Configure the width of the text cursor. Automatic zoom-controlled cursor width used when set to 0.");
3174 case RC_SCROLL_BELOW_DOCUMENT:
3175 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");
3178 case RC_MAC_DONTSWAP_CTRL_META:
3179 str = _("Make Apple key act as Meta and Control key as Ctrl.");
3182 case RC_MAC_LIKE_CURSOR_MOVEMENT:
3183 str = _("Use the Mac OS X conventions for cursor movement");
3186 case RC_SHOW_MACRO_LABEL:
3187 str = _("Show a small box around a Math Macro with the macro name when the cursor is inside.");
3190 case RC_DATE_INSERT_FORMAT:
3191 //xgettext:no-c-format
3192 str = _("This accepts the normal strftime formats; see man strftime for full details. E.g.\"%A, %e. %B %Y\".");
3196 str = _("Command definition file. Can either specify an absolute path, or LyX will look in its global and local commands/ directories.");
3199 case RC_DEFAULT_OTF_VIEW_FORMAT:
3200 str = _("The default format used with LFUN_BUFFER_[VIEW|UPDATE] with non-TeX fonts.");
3203 case RC_DEFAULT_VIEW_FORMAT:
3204 str = _("The default format used with LFUN_BUFFER_[VIEW|UPDATE].");
3207 case RC_DIALOGS_ICONIFY_WITH_MAIN:
3208 str = _("Iconify the dialogs when the main window is iconified. (Affects only dialogs shown after the change has been made.)");
3211 case RC_DISPLAY_GRAPHICS:
3212 str = _("Select how LyX will display any graphics.");
3215 case RC_DOCUMENTPATH:
3216 str = _("The default path for your documents. An empty value selects the directory LyX was started from.");
3220 str = _("Specify additional chars that can be part of a word.");
3223 case RC_EXAMPLEPATH:
3224 str = _("The path that LyX will set when offering to choose an example. An empty value selects the directory LyX was started from.");
3227 case RC_FONT_ENCODING:
3228 str = _("The font encoding used for the LaTeX2e fontenc package. T1 is highly recommended for non-English languages.");
3231 case RC_FORCE_PAINT_SINGLE_CHAR:
3232 str = _("Disable any kerning and ligatures for text drawing on screen.");
3238 case RC_INDEX_COMMAND:
3239 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\".");
3242 case RC_JINDEX_COMMAND:
3243 str = _("Define the options of the index program for PLaTeX (Japanese LaTeX).");
3246 case RC_NOMENCL_COMMAND:
3247 str = _("Define the options of makeindex (cf. man makeindex) to be used for nomenclatures. This might differ from the index processing options.");
3254 case RC_KBMAP_PRIMARY:
3255 case RC_KBMAP_SECONDARY:
3256 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.");
3259 case RC_LANGUAGE_AUTO_BEGIN:
3260 str = _("Select if a language switching command is needed at the beginning of the document.");
3263 case RC_LANGUAGE_AUTO_END:
3264 str = _("Select if a language switching command is needed at the end of the document.");
3267 case RC_LANGUAGE_COMMAND_BEGIN:
3268 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.");
3271 case RC_LANGUAGE_COMMAND_END:
3272 str = _("The LaTeX command for changing back to the language of the document.");
3275 case RC_LANGUAGE_COMMAND_LOCAL:
3276 str = _("The LaTeX command for local changing of the language.");
3279 case RC_LANGUAGE_GLOBAL_OPTIONS:
3280 str = _("De-select if you don't want the language(s) used as an argument to \\documentclass.");
3283 case RC_LANGUAGE_CUSTOM_PACKAGE:
3284 str = _("The LaTeX command for loading the language package. E.g. \"\\usepackage{babel}\", \"\\usepackage{omega}\".");
3287 case RC_LANGUAGE_PACKAGE_SELECTION:
3288 str = _("De-select if you don't want babel to be used when the language of the document is the default language.");
3291 case RC_USELASTFILEPOS:
3292 str = _("De-select if you do not want LyX to scroll to saved position.");
3295 case RC_LOADSESSION:
3296 str = _("De-select to prevent loading files opened from the last LyX session.");
3299 case RC_MAKE_BACKUP:
3300 str = _("De-select if you don't want LyX to create backup files.");
3303 case RC_MARK_FOREIGN_LANGUAGE:
3304 str = _("Select to control the highlighting of words with a language foreign to that of the document.");
3307 case RC_MOUSE_WHEEL_SPEED:
3308 str = bformat(_("The scrolling speed of the mouse wheel."),
3312 case RC_COMPLETION_POPUP_DELAY:
3313 str = _("The completion popup delay.");
3316 case RC_COMPLETION_POPUP_MATH:
3317 str = _("Select to display the completion popup in math mode.");
3320 case RC_COMPLETION_POPUP_TEXT:
3321 str = _("Select to display the completion popup in text mode.");
3324 case RC_COMPLETION_POPUP_AFTER_COMPLETE:
3325 str = _("Show the completion popup without delay after non-unique completion attempt.");
3328 case RC_COMPLETION_POPUP_TEXT:
3329 str = _("Show a small triangle on the cursor to indicate that a completion is available.");
3332 case RC_COMPLETION_POPUP_DELAY:
3333 str = _("The inline completion delay.");
3336 case RC_COMPLETION_INLINE_MATH:
3337 str = _("Select to display the inline completion in math mode.");
3340 case RC_COMPLETION_INLINE_TEXT:
3341 str = _("Select to display the inline completion in text mode.");
3344 case RC_COMPLETION_INLINE_DOTS:
3345 str = _("Use \"...\" to shorten long completions.");
3348 case RC_AUTOCORRECTION_MATH:
3349 str = _("Allow TeXMacs shorthand, like => converting to \Rightarrow.");
3352 case RC_NUMLASTFILES:
3353 str = bformat(_("Maximal number of lastfiles. Up to %1$d can appear in the file menu."),
3357 case RC_PATH_PREFIX:
3358 str = _("Specify those directories which should be "
3359 "prepended to the PATH environment variable.\n"
3360 "Use the OS native format.");
3364 str = _("Shows a typeset preview of things such as math");
3367 case RC_PREVIEW_HASHED_LABELS:
3368 str = _("Previewed equations will have \"(#)\" labels rather than numbered ones");
3371 case RC_PREVIEW_SCALE_FACTOR:
3372 str = _("Scale the preview size to suit.");
3375 case RC_PRINTCOLLCOPIESFLAG:
3376 str = _("The option for specifying whether the copies should be collated.");
3379 case RC_PRINTCOPIESFLAG:
3380 str = _("The option for specifying the number of copies to print.");
3384 str = _("The default printer to print on. If none is specified, LyX will use the environment variable PRINTER.");
3387 case RC_PRINTEVENPAGEFLAG:
3388 str = _("The option to print only even pages.");
3391 case RC_PRINTEXSTRAOPTIONS:
3392 str = _("Extra options to pass to printing program after everything else, but before the filename of the DVI file to be printed.");
3395 case RC_PRINTFILEEXTENSION:
3396 str = _("Extension of printer program output file. Usually \".ps\".");
3399 case RC_PRINTLANDSCAPEFLAG:
3400 str = _("The option to print out in landscape.");
3403 case RC_PRINTODDPAGEFLAG:
3404 str = _("The option to print only odd pages.");
3407 case RC_PRINTPAGERANGEFLAG:
3408 str = _("The option for specifying a comma-separated list of pages to print.");
3411 case RC_PRINTPAPERDIMENSIONFLAG:
3412 str = _("Option to specify the dimensions of the print paper.");
3415 case RC_PRINTPAPERFLAG:
3416 str = _("The option to specify paper type.");
3419 case RC_PRINTREVERSEFLAG:
3420 str = _("The option to reverse the order of the pages printed.");
3423 case RC_PRINTSPOOL_COMMAND:
3424 str = _("When set, this printer option automatically prints to a file and then calls a separate print spooling program on that file with the given name and arguments.");
3427 case RC_PRINTSPOOL_PRINTERPREFIX:
3428 str = _("If you specify a printer name in the print dialog, the following argument is prepended along with the printer name after the spool command.");
3431 case RC_PRINTTOFILE:
3432 str = _("Option to pass to the print program to print to a file.");
3435 case RC_PRINTTOPRINTER:
3436 str = _("Option to pass to the print program to print on a specific printer.");
3439 case RC_PRINT_ADAPTOUTPUT:
3440 str = _("Select for LyX to pass the name of the destination printer to your print command.");
3443 case RC_PRINT_COMMAND:
3444 str = _("Your favorite print program, e.g. \"dvips\", \"dvilj4\".");
3447 case RC_RTL_SUPPORT:
3448 str = _("Select to enable support of right-to-left languages (e.g. Hebrew, Arabic).");
3451 case RC_VISUAL_CURSOR:
3452 str = _("Select to have visual bidi cursor movement, unselect for logical movement.");
3455 case RC_CLOSE_BUFFER_WITH_LAST_VIEW:
3456 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).");
3460 str = _("DPI (dots per inch) of your monitor is auto-detected by LyX. If that goes wrong, override the setting here.");
3463 case RC_SCREEN_FONT_ROMAN:
3464 case RC_SCREEN_FONT_SANS:
3465 case RC_SCREEN_FONT_TYPEWRITER:
3466 str = _("The screen fonts used to display the text while editing.");
3469 case RC_SCREEN_FONT_ROMAN_FOUNDRY:
3470 case RC_SCREEN_FONT_SANS_FOUNDRY:
3471 case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
3474 case RC_SCREEN_FONT_SCALABLE:
3475 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.");
3478 case RC_SCREEN_FONT_SIZES:
3479 str = _("The font sizes used for calculating the scaling of the screen fonts.");
3482 case RC_SCREEN_ZOOM:
3483 //xgettext:no-c-format
3484 str = _("The zoom percentage for screen fonts. A setting of 100% will make the fonts roughly the same size as on paper.");
3487 case RC_GEOMETRY_SESSION:
3488 str = _("Allow session manager to save and restore windows geometry.");
3492 str = _("This starts the lyxserver. The pipes get an additional extension \".in\" and \".out\". Only for advanced users.");
3498 case RC_SHOW_BANNER:
3499 str = _("De-select if you don't want the startup banner.");
3502 case RC_TEMPDIRPATH:
3503 str = _("LyX will place its temporary directories in this path. They will be deleted when you quit LyX.");
3506 case RC_THESAURUSDIRPATH:
3507 str = _("This is the place where the files of the thesaurus library reside.");
3510 case RC_TEMPLATEPATH:
3511 str = _("The path that LyX will set when offering to choose a template. An empty value selects the directory LyX was started from.");
3514 case RC_TEX_ALLOWS_SPACES:
3517 case RC_TEX_EXPECTS_WINDOWS_PATHS:
3520 case RC_TEXINPUTS_PREFIX:
3521 str = _("Specify those directories which should be "
3522 "prepended to the TEXINPUTS environment variable.\n"
3523 "A '.' represents the current document directory. "
3524 "Use the OS native format.");
3528 str = _("The UI (user interface) file. Can either specify an absolute path, or LyX will look in its global and local ui/ directories.");
3537 case RC_USE_USE_SYSTEM_COLORS:
3538 str = _("Enable use the system colors for some things like main window background and selection.");
3541 case RC_USE_TOOLTIP:
3542 str = _("Enable the automatic appearance of tool tips in the work area.");
3545 case RC_USE_PIXMAP_CACHE:
3546 str = _("Enable the pixmap cache that might improve performance on Mac and Windows.");
3549 case RC_VIEWDVI_PAPEROPTION:
3550 _("Specify the paper command to DVI viewer (leave empty or use \"-paper\")");
3565 // The global instance
3568 // The global copy of the system lyxrc entries (everything except preferences)