3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
6 * \author Lars Gullik Bjønnes
7 * \author Jean-Marc Lasgouttes
8 * \author Angus Leeming
10 * \author André Pönitz
14 * Full author contact details are available in file CREDITS.
21 #include "BufferList.h"
23 #include "Converter.h"
24 #include "FontEnums.h"
27 #include "FuncRequest.h"
32 #include "SpellChecker.h"
35 #include "graphics/GraphicsTypes.h"
37 #include "support/convert.h"
38 #include "support/debug.h"
39 #include "support/environment.h"
40 #include "support/FileName.h"
41 #include "support/filetools.h"
42 #include "support/gettext.h"
43 #include "support/lstrings.h"
44 #include "support/os.h"
45 #include "support/Package.h"
46 #include "support/TempFile.h"
47 #include "support/userinfo.h"
54 using namespace lyx::support;
58 namespace os = support::os;
62 // The format should also be updated in configure.py, and conversion code
63 // should be added to prefs2prefs_prefs.py.
64 static unsigned int const LYXRC_FILEFORMAT = 29; // spitz: remove \\date_insert_format
65 // when adding something to this array keep it sorted!
66 LexerKeyword lyxrcTags[] = {
67 { "\\accept_compound", LyXRC::RC_ACCEPT_COMPOUND },
68 { "\\allow_geometry_session", LyXRC::RC_GEOMETRY_SESSION },
69 { "\\alternate_language", LyXRC::RC_ALT_LANG },
70 { "\\auto_number", LyXRC::RC_AUTO_NUMBER },
71 { "\\auto_region_delete", LyXRC::RC_AUTOREGIONDELETE },
72 { "\\auto_reset_options", LyXRC::RC_AUTORESET_OPTIONS },
73 { "\\autocorrection_math", LyXRC::RC_AUTOCORRECTION_MATH },
74 { "\\autosave", LyXRC::RC_AUTOSAVE },
75 { "\\backupdir_path", LyXRC::RC_BACKUPDIR_PATH },
76 { "\\bibtex_alternatives", LyXRC::RC_BIBTEX_ALTERNATIVES },
77 { "\\bibtex_command", LyXRC::RC_BIBTEX_COMMAND },
78 { "\\bind_file", LyXRC::RC_BINDFILE },
79 { "\\check_lastfiles", LyXRC::RC_CHECKLASTFILES },
80 { "\\chktex_command", LyXRC::RC_CHKTEX_COMMAND },
81 { "\\close_buffer_with_last_view", LyXRC::RC_CLOSE_BUFFER_WITH_LAST_VIEW },
82 { "\\completion_cursor_text", LyXRC::RC_COMPLETION_CURSOR_TEXT },
83 { "\\completion_inline_delay", LyXRC::RC_COMPLETION_INLINE_DELAY },
84 { "\\completion_inline_dots", LyXRC::RC_COMPLETION_INLINE_DOTS },
85 { "\\completion_inline_math", LyXRC::RC_COMPLETION_INLINE_MATH },
86 { "\\completion_inline_text", LyXRC::RC_COMPLETION_INLINE_TEXT },
87 { "\\completion_minlength", LyXRC::RC_COMPLETION_MINLENGTH },
88 { "\\completion_popup_after_complete", LyXRC::RC_COMPLETION_POPUP_AFTER_COMPLETE },
89 { "\\completion_popup_delay", LyXRC::RC_COMPLETION_POPUP_DELAY },
90 { "\\completion_popup_math", LyXRC::RC_COMPLETION_POPUP_MATH },
91 { "\\completion_popup_text", LyXRC::RC_COMPLETION_POPUP_TEXT },
92 { "\\converter", LyXRC::RC_CONVERTER },
93 { "\\converter_cache_maxage", LyXRC::RC_CONVERTER_CACHE_MAXAGE },
94 { "\\copier", LyXRC::RC_COPIER },
95 { "\\cursor_follows_scrollbar", LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR },
96 { "\\cursor_width", LyXRC::RC_CURSOR_WIDTH },
97 { "\\def_file", LyXRC::RC_DEFFILE },
98 { "\\default_decimal_point", LyXRC::RC_DEFAULT_DECIMAL_POINT },
99 { "\\default_length_unit", LyXRC::RC_DEFAULT_LENGTH_UNIT },
100 { "\\default_otf_view_format", LyXRC::RC_DEFAULT_OTF_VIEW_FORMAT },
101 { "\\default_platex_view_format", LyXRC::RC_DEFAULT_PLATEX_VIEW_FORMAT },
102 { "\\default_view_format", LyXRC::RC_DEFAULT_VIEW_FORMAT },
103 { "\\dialogs_iconify_with_main", LyXRC::RC_DIALOGS_ICONIFY_WITH_MAIN },
104 { "\\display_graphics", LyXRC::RC_DISPLAY_GRAPHICS },
105 { "\\document_path", LyXRC::RC_DOCUMENTPATH },
106 { "\\editor_alternatives", LyXRC::RC_EDITOR_ALTERNATIVES },
107 { "\\escape_chars", LyXRC::RC_ESC_CHARS },
108 { "\\example_path", LyXRC::RC_EXAMPLEPATH },
109 { "\\export_overwrite", LyXRC::RC_EXPORT_OVERWRITE },
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_alternatives", LyXRC::RC_JBIBTEX_ALTERNATIVES },
128 { "\\jbibtex_command", LyXRC::RC_JBIBTEX_COMMAND },
129 { "\\jindex_command", LyXRC::RC_JINDEX_COMMAND },
130 { "\\kbmap", LyXRC::RC_KBMAP },
131 { "\\kbmap_primary", LyXRC::RC_KBMAP_PRIMARY },
132 { "\\kbmap_secondary", LyXRC::RC_KBMAP_SECONDARY },
133 { "\\language_auto_begin", LyXRC::RC_LANGUAGE_AUTO_BEGIN },
134 { "\\language_auto_end", LyXRC::RC_LANGUAGE_AUTO_END },
135 { "\\language_command_begin", LyXRC::RC_LANGUAGE_COMMAND_BEGIN },
136 { "\\language_command_end", LyXRC::RC_LANGUAGE_COMMAND_END },
137 { "\\language_command_local", LyXRC::RC_LANGUAGE_COMMAND_LOCAL },
138 { "\\language_custom_package", LyXRC::RC_LANGUAGE_CUSTOM_PACKAGE },
139 { "\\language_global_options", LyXRC::RC_LANGUAGE_GLOBAL_OPTIONS },
140 { "\\language_package_selection", LyXRC::RC_LANGUAGE_PACKAGE_SELECTION },
141 { "\\load_session", LyXRC::RC_LOADSESSION },
142 { "\\mac_dontswap_ctrl_meta", LyXRC::RC_MAC_DONTSWAP_CTRL_META },
143 { "\\mac_like_cursor_movement", LyXRC::RC_MAC_LIKE_CURSOR_MOVEMENT },
144 { "\\macro_edit_style", LyXRC::RC_MACRO_EDIT_STYLE },
145 { "\\make_backup", LyXRC::RC_MAKE_BACKUP },
146 { "\\mark_foreign_language", LyXRC::RC_MARK_FOREIGN_LANGUAGE },
147 { "\\mouse_middlebutton_paste", LyXRC::RC_MOUSE_MIDDLEBUTTON_PASTE },
148 { "\\mouse_wheel_speed", LyXRC::RC_MOUSE_WHEEL_SPEED },
149 { "\\nomencl_command", LyXRC::RC_NOMENCL_COMMAND },
150 { "\\num_lastfiles", LyXRC::RC_NUMLASTFILES },
151 { "\\open_buffers_in_tabs", LyXRC::RC_OPEN_BUFFERS_IN_TABS },
152 { "\\paragraph_markers", LyXRC::RC_PARAGRAPH_MARKERS },
153 { "\\path_prefix", LyXRC::RC_PATH_PREFIX },
154 { "\\plaintext_linelen", LyXRC::RC_PLAINTEXT_LINELEN },
155 { "\\preview", LyXRC::RC_PREVIEW },
156 { "\\preview_hashed_labels", LyXRC::RC_PREVIEW_HASHED_LABELS },
157 { "\\preview_scale_factor", LyXRC::RC_PREVIEW_SCALE_FACTOR },
158 { "\\print_landscape_flag", LyXRC::RC_PRINTLANDSCAPEFLAG },
159 { "\\print_paper_dimension_flag", LyXRC::RC_PRINTPAPERDIMENSIONFLAG },
160 { "\\print_paper_flag", LyXRC::RC_PRINTPAPERFLAG },
161 { "\\pygmentize_command", LyXRC::RC_PYGMENTIZE_COMMAND },
162 { "\\save_compressed", LyXRC::RC_SAVE_COMPRESSED },
163 { "\\save_origin", LyXRC::RC_SAVE_ORIGIN },
164 { "\\screen_dpi", LyXRC::RC_SCREEN_DPI },
165 { "\\screen_font_roman", LyXRC::RC_SCREEN_FONT_ROMAN },
166 { "\\screen_font_roman_foundry", LyXRC::RC_SCREEN_FONT_ROMAN_FOUNDRY },
167 { "\\screen_font_sans", LyXRC::RC_SCREEN_FONT_SANS },
168 { "\\screen_font_sans_foundry", LyXRC::RC_SCREEN_FONT_SANS_FOUNDRY },
169 { "\\screen_font_scalable", LyXRC::RC_SCREEN_FONT_SCALABLE },
170 { "\\screen_font_sizes", LyXRC::RC_SCREEN_FONT_SIZES },
171 { "\\screen_font_typewriter", LyXRC::RC_SCREEN_FONT_TYPEWRITER },
172 { "\\screen_font_typewriter_foundry", LyXRC::RC_SCREEN_FONT_TYPEWRITER_FOUNDRY },
173 { "\\screen_zoom", LyXRC::RC_SCREEN_ZOOM },
174 { "\\scroll_below_document", LyXRC::RC_SCROLL_BELOW_DOCUMENT },
175 { "\\scroll_wheel_zoom", LyXRC::RC_SCROLL_WHEEL_ZOOM },
176 { "\\serverpipe", LyXRC::RC_SERVERPIPE },
177 { "\\set_color", LyXRC::RC_SET_COLOR },
178 { "\\show_banner", LyXRC::RC_SHOW_BANNER },
179 { "\\single_close_tab_button", LyXRC::RC_SINGLE_CLOSE_TAB_BUTTON },
180 { "\\single_instance", LyXRC::RC_SINGLE_INSTANCE },
181 { "\\sort_layouts", LyXRC::RC_SORT_LAYOUTS },
182 { "\\spellcheck_continuously", LyXRC::RC_SPELLCHECK_CONTINUOUSLY },
183 { "\\spellcheck_notes", LyXRC::RC_SPELLCHECK_NOTES },
184 { "\\spellchecker", LyXRC::RC_SPELLCHECKER },
185 { "\\splitindex_command", LyXRC::RC_SPLITINDEX_COMMAND },
186 { "\\tempdir_path", LyXRC::RC_TEMPDIRPATH },
187 { "\\template_path", LyXRC::RC_TEMPLATEPATH },
188 { "\\tex_allows_spaces", LyXRC::RC_TEX_ALLOWS_SPACES },
189 { "\\tex_expects_windows_paths", LyXRC::RC_TEX_EXPECTS_WINDOWS_PATHS },
190 { "\\texinputs_prefix", LyXRC::RC_TEXINPUTS_PREFIX },
191 { "\\thesaurusdir_path", LyXRC::RC_THESAURUSDIRPATH },
192 { "\\ui_file", LyXRC::RC_UIFILE },
193 { "\\use_converter_cache", LyXRC::RC_USE_CONVERTER_CACHE },
194 { "\\use_converter_needauth", LyXRC::RC_USE_CONVERTER_NEEDAUTH },
195 { "\\use_converter_needauth_forbidden", LyXRC::RC_USE_CONVERTER_NEEDAUTH_FORBIDDEN },
196 { "\\use_lastfilepos", LyXRC::RC_USELASTFILEPOS },
197 { "\\use_native_filedialog", LyXRC::RC_USE_NATIVE_FILEDIALOG },
198 // compatibility with versions older than 1.4.0 only
199 { "\\use_system_colors", LyXRC::RC_USE_SYSTEM_COLORS },
200 { "\\use_system_theme_icons", LyXRC::RC_USE_SYSTEM_THEME_ICONS },
201 { "\\use_tooltip", LyXRC::RC_USE_TOOLTIP },
202 { "\\user_email", LyXRC::RC_USER_EMAIL },
203 { "\\user_name", LyXRC::RC_USER_NAME },
204 { "\\view_dvi_paper_option", LyXRC::RC_VIEWDVI_PAPEROPTION },
205 // compatibility with versions older than 1.4.0 only
206 { "\\viewer", LyXRC::RC_VIEWER},
207 { "\\viewer_alternatives", LyXRC::RC_VIEWER_ALTERNATIVES },
208 { "\\visual_cursor", LyXRC::RC_VISUAL_CURSOR },
209 { "format", LyXRC::RC_LYXRCFORMAT }
212 const int lyxrcCount = sizeof(lyxrcTags) / sizeof(lyxrcTags[0]);
223 void LyXRC::setDefaults()
226 use_system_theme_icons = false;
228 def_file = "default";
230 // The current document directory
231 texinputs_prefix = ".";
232 print_landscape_flag = "-t landscape";
233 print_paper_flag = "-t";
234 print_paper_dimension_flag = "-T";
235 document_path.erase();
236 view_dvi_paper_option.erase();
237 default_view_format = "pdf2";
238 default_otf_view_format = "pdf4";
239 default_platex_view_format = "pdf3";
240 chktex_command = "chktex -n1 -n3 -n6 -n9 -n22 -n25 -n30 -n38";
241 bibtex_command = "automatic";
242 index_command = "makeindex -c -q";
243 nomencl_command = "makeindex -s nomencl.ist";
244 pygmentize_command = string();
246 // Because a screen is typically wider than a piece of paper:
248 currentZoom = defaultZoom;
249 allow_geometry_session = true;
250 // Default LaTeX font size:
251 font_sizes[FONT_SIZE_TINY] = "5.0";
252 font_sizes[FONT_SIZE_SCRIPT] = "7.0";
253 font_sizes[FONT_SIZE_FOOTNOTE] = "8.0";
254 font_sizes[FONT_SIZE_SMALL] = "9.0";
255 font_sizes[FONT_SIZE_NORMAL] = "10.0";
256 font_sizes[FONT_SIZE_LARGE] = "12.0";
257 font_sizes[FONT_SIZE_LARGER] = "14.4";
258 font_sizes[FONT_SIZE_LARGEST] = "17.26";
259 font_sizes[FONT_SIZE_HUGE] = "20.74";
260 font_sizes[FONT_SIZE_HUGER] = "24.88";
261 use_scalable_fonts = true;
262 roman_font_name = "";
264 typewriter_font_name = "";
266 auto_region_delete = true;
267 auto_reset_options = false;
268 plaintext_linelen = 65;
269 mouse_wheel_speed = 1.0;
271 check_lastfiles = true;
272 use_lastfilepos = true;
273 use_native_filedialog = true;
274 load_session = false;
276 save_compressed = false;
278 backupdir_path.erase();
279 display_graphics = true;
280 // Spellchecker settings:
281 // FIXME: this check should test the target platform (darwin)
282 #if defined(USE_MACOSX_PACKAGING)
283 spellchecker = "native";
284 #elif defined(USE_ENCHANT)
285 spellchecker = "enchant";
286 #elif defined(USE_ASPELL)
287 spellchecker = "aspell";
288 #elif defined(USE_HUNSPELL)
289 spellchecker = "hunspell";
291 spellchecker = "aspell";
293 spellchecker_accept_compound = false;
294 spellcheck_continuously = false;
295 completion_minlength = 6;
296 spellcheck_notes = true;
298 visual_cursor = false;
300 mark_foreign_language = true;
301 language_auto_begin = true;
302 language_auto_end = true;
303 language_global_options = true;
304 language_package_selection = LP_AUTO;
305 language_custom_package = "\\usepackage{babel}";
306 language_command_begin = "\\selectlanguage{$$lang}";
307 language_command_local = "\\foreignlanguage{$$lang}{";
308 sort_layouts = false;
309 group_layouts = true;
310 gui_language = "auto";
312 windows_style_tex_paths = false;
313 tex_allows_spaces = false;
314 cursor_follows_scrollbar = false;
315 scroll_below_document = false;
316 scroll_wheel_zoom = SCROLL_WHEEL_ZOOM_CTRL;
317 paragraph_markers = false;
318 mac_dontswap_ctrl_meta = false;
319 mac_like_cursor_movement = false;
320 macro_edit_style = MACRO_EDIT_INLINE_BOX;
321 dialogs_iconify_with_main = false;
322 preview = PREVIEW_OFF;
323 preview_hashed_labels = false;
324 preview_scale_factor = 1.0;
325 use_converter_cache = true;
326 use_converter_needauth_forbidden = true;
327 use_converter_needauth = true;
328 use_system_colors = false;
330 converter_cache_maxage = 6 * 30 * 24 * 3600; // 6 months
331 user_name = to_utf8(support::user_name());
332 user_email = to_utf8(support::user_email());
333 open_buffers_in_tabs = true;
334 single_close_tab_button = false;
335 single_instance = true;
336 forward_search_dvi = string();
337 forward_search_pdf = string();
338 export_overwrite = NO_FILES;
340 // Fullscreen settings
341 full_screen_limit = false;
342 full_screen_toolbars = true;
343 full_screen_tabbar = true;
344 full_screen_menubar = true;
345 full_screen_statusbar = true;
346 full_screen_scrollbar = true;
347 full_screen_width = 700;
349 completion_cursor_text = true;
350 completion_popup_math = true;
351 completion_popup_text = false;
352 completion_popup_delay = 2.0;
353 completion_popup_after_complete = true;
354 autocorrection_math = false;
355 completion_inline_math = true;
356 completion_inline_text = false;
357 completion_inline_dots = -1;
358 completion_inline_delay = 0.2;
359 default_decimal_point = ".";
360 default_length_unit = Length::CM;
362 close_buffer_with_last_view = "yes";
363 mouse_middlebutton_paste = true;
369 void oldFontFormat(string & family, string & foundry)
371 if (family.empty() || family[0] != '-')
373 foundry = token(family, '-', 1);
374 family = token(family, '-', 2);
382 bool LyXRC::read(FileName const & filename, bool check_format)
384 Lexer lexrc(lyxrcTags);
385 lexrc.setFile(filename);
386 LYXERR(Debug::LYXRC, "Reading '" << filename << "'...");
387 ReturnValues retval = read(lexrc, check_format);
388 if (!check_format || retval != FormatMismatch)
389 return retval == ReadOK;
391 LYXERR(Debug::FILES, "Converting LyXRC file to " << LYXRC_FILEFORMAT);
392 TempFile tmp("convert_lyxrc");
393 FileName const tempfile = tmp.name();
394 bool const success = prefs2prefs(filename, tempfile, false);
396 LYXERR0 ("Unable to convert " << filename.absFileName() <<
397 " to format " << LYXRC_FILEFORMAT);
400 // Keep this in the else branch, such that lexrc2 goes out
401 // of scope and releases the lock on tempfile before we
402 // attempt to remove it. This matters on Windows.
403 Lexer lexrc2(lyxrcTags);
404 lexrc2.setFile(tempfile);
405 LYXERR(Debug::LYXRC, "Reading '" << tempfile << "'...");
406 retval = read(lexrc2, check_format);
407 if (retval == FormatMismatch)
408 LYXERR0("Conversion failed for " << filename.absFileName());
410 return retval == ReadOK;
414 // don't need to worry about conversion, because this is always
415 // from an internal source
416 bool LyXRC::read(istream & is)
418 Lexer lexrc(lyxrcTags);
420 LYXERR(Debug::LYXRC, "Reading istream...");
421 return read(lexrc, false) == ReadOK;
425 LyXRC::ReturnValues LyXRC::read(Lexer & lexrc, bool check_format)
427 if (lyxerr.debugging(Debug::PARSER))
428 lexrc.printTable(lyxerr);
433 // format prior to 2.0 and introduction of format tag
434 unsigned int rc_format = 0;
436 while (lexrc.isOK()) {
437 // By using two switches we take advantage of the compiler
438 // telling us if we have missed a LyXRCTags element in
439 // the second switch.
440 // Note that this also shows a problem with Lexer since it
441 // helps us avoid taking advantage of the strictness of the
444 int le = lexrc.lex();
446 case Lexer::LEX_UNDEF:
447 lexrc.printError("Unknown tag `$$Token'");
449 case Lexer::LEX_FEOF:
454 switch (static_cast<LyXRCTags>(le)) {
457 rc_format = lexrc.getInteger();
459 case RC_INPUT: // Include file
462 libFileSearch(string(),
464 if (!read(tmp, check_format)) {
466 "Error reading included file: " + tmp.absFileName());
472 bind_file = os::internal_path(lexrc.getString());
477 def_file = os::internal_path(lexrc.getString());
482 ui_file = os::internal_path(lexrc.getString());
485 case RC_AUTORESET_OPTIONS:
486 lexrc >> auto_reset_options;
489 case RC_DISPLAY_GRAPHICS:
491 display_graphics = lexrc.getString() == "true";
494 case RC_TEX_EXPECTS_WINDOWS_PATHS:
495 lexrc >> windows_style_tex_paths;
498 case RC_TEX_ALLOWS_SPACES:
499 lexrc >> tex_allows_spaces;
502 case RC_TEXINPUTS_PREFIX:
503 lexrc >> texinputs_prefix;
510 case RC_KBMAP_PRIMARY:
512 string const kmap(os::internal_path(lexrc.getString()));
513 if (!libFileSearch("kbd", kmap, "kmap").empty()
515 primary_kbmap = kmap;
517 lexrc.printError("LyX: Keymap `$$Token' not found");
522 case RC_KBMAP_SECONDARY:
524 string const kmap(os::internal_path(lexrc.getString()));
525 if (!libFileSearch("kbd", kmap, "kmap").empty()
527 secondary_kbmap = kmap;
529 lexrc.printError("LyX: Keymap `$$Token' not found");
534 case RC_PRINTLANDSCAPEFLAG:
535 lexrc >> print_landscape_flag;
538 case RC_PRINTPAPERDIMENSIONFLAG:
539 lexrc >> print_paper_dimension_flag;
542 case RC_PRINTPAPERFLAG:
543 lexrc >> print_paper_flag;
546 case RC_PYGMENTIZE_COMMAND:
547 if (lexrc.next(true)) {
548 pygmentize_command = lexrc.getString();
552 case RC_VIEWDVI_PAPEROPTION:
554 view_dvi_paper_option = lexrc.getString();
556 view_dvi_paper_option.erase();
559 case RC_CHKTEX_COMMAND:
560 if (lexrc.next(true)) {
561 chktex_command = lexrc.getString();
565 case RC_BIBTEX_ALTERNATIVES:
566 if (lexrc.next(true)) {
567 bibtex_alternatives.insert(lexrc.getString());
571 case RC_BIBTEX_COMMAND:
572 if (lexrc.next(true)) {
573 bibtex_command = lexrc.getString();
577 case RC_JBIBTEX_COMMAND:
578 if (lexrc.next(true)) {
579 jbibtex_command = lexrc.getString();
583 case RC_JBIBTEX_ALTERNATIVES:
584 if (lexrc.next(true)) {
585 jbibtex_alternatives.insert(lexrc.getString());
589 case RC_INDEX_ALTERNATIVES:
590 if (lexrc.next(true)) {
591 index_alternatives.insert(lexrc.getString());
595 case RC_INDEX_COMMAND:
596 if (lexrc.next(true)) {
597 index_command = lexrc.getString();
601 case RC_JINDEX_COMMAND:
602 if (lexrc.next(true)) {
603 jindex_command = lexrc.getString();
607 case RC_SPLITINDEX_COMMAND:
608 if (lexrc.next(true)) {
609 splitindex_command = lexrc.getString();
613 case RC_NOMENCL_COMMAND:
614 if (lexrc.next(true)) {
615 nomencl_command = lexrc.getString();
624 lexrc >> defaultZoom;
625 if (defaultZoom < 10)
629 case RC_GEOMETRY_SESSION:
630 lexrc >> allow_geometry_session;
633 case RC_SCREEN_FONT_SIZES:
634 lexrc >> font_sizes[FONT_SIZE_TINY];
635 lexrc >> font_sizes[FONT_SIZE_SCRIPT];
636 lexrc >> font_sizes[FONT_SIZE_FOOTNOTE];
637 lexrc >> font_sizes[FONT_SIZE_SMALL];
638 lexrc >> font_sizes[FONT_SIZE_NORMAL];
639 lexrc >> font_sizes[FONT_SIZE_LARGE];
640 lexrc >> font_sizes[FONT_SIZE_LARGER];
641 lexrc >> font_sizes[FONT_SIZE_LARGEST];
642 lexrc >> font_sizes[FONT_SIZE_HUGE];
643 lexrc >> font_sizes[FONT_SIZE_HUGER];
646 case RC_SCREEN_FONT_SCALABLE:
647 lexrc >> use_scalable_fonts;
654 case RC_DOCUMENTPATH:
656 document_path = os::internal_path(lexrc.getString());
661 example_path = os::internal_path(lexrc.getString());
664 case RC_TEMPLATEPATH:
666 template_path = os::internal_path(lexrc.getString());
671 tempdir_path = os::internal_path(lexrc.getString());
674 case RC_THESAURUSDIRPATH:
676 thesaurusdir_path = os::internal_path(lexrc.getString());
679 case RC_HUNSPELLDIR_PATH:
681 hunspelldir_path = os::internal_path(lexrc.getString());
684 case RC_USELASTFILEPOS:
685 lexrc >> use_lastfilepos;
689 lexrc >> load_session;
692 case RC_MOUSE_WHEEL_SPEED:
693 lexrc >> mouse_wheel_speed;
696 case RC_COMPLETION_INLINE_DELAY:
697 lexrc >> completion_inline_delay;
700 case RC_COMPLETION_INLINE_MATH:
701 lexrc >> completion_inline_math;
704 case RC_COMPLETION_INLINE_TEXT:
705 lexrc >> completion_inline_text;
708 case RC_COMPLETION_INLINE_DOTS:
709 lexrc >> completion_inline_dots;
712 case RC_AUTOCORRECTION_MATH:
713 lexrc >> autocorrection_math;
716 case RC_COMPLETION_POPUP_DELAY:
717 lexrc >> completion_popup_delay;
720 case RC_COMPLETION_POPUP_MATH:
721 lexrc >> completion_popup_math;
724 case RC_COMPLETION_POPUP_TEXT:
725 lexrc >> completion_popup_text;
728 case RC_COMPLETION_CURSOR_TEXT:
729 lexrc >> completion_cursor_text;
732 case RC_COMPLETION_POPUP_AFTER_COMPLETE:
733 lexrc >> completion_popup_after_complete;
736 case RC_COMPLETION_MINLENGTH:
737 lexrc >> completion_minlength;
740 case RC_NUMLASTFILES:
741 lexrc >> num_lastfiles;
744 case RC_CHECKLASTFILES:
745 lexrc >> check_lastfiles;
752 case RC_USE_SYSTEM_THEME_ICONS:
753 lexrc >> use_system_theme_icons;
756 case RC_SCREEN_FONT_ROMAN:
758 roman_font_name = lexrc.getString();
759 oldFontFormat(roman_font_name,
764 case RC_SCREEN_FONT_SANS:
766 sans_font_name = lexrc.getString();
767 oldFontFormat(sans_font_name, sans_font_foundry);
771 case RC_SCREEN_FONT_TYPEWRITER:
773 typewriter_font_name = lexrc.getString();
774 oldFontFormat(typewriter_font_name,
775 typewriter_font_foundry);
779 case RC_SCREEN_FONT_ROMAN_FOUNDRY:
780 lexrc >> roman_font_foundry;
783 case RC_SCREEN_FONT_SANS_FOUNDRY:
784 lexrc >> sans_font_foundry;
787 case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
788 lexrc >> typewriter_font_foundry;
793 lexrc.printError("Missing color tag.");
796 string lyx_name = lexrc.getString();
799 lexrc.printError("Missing color name for color: `$$Token'");
802 string x11_name = lexrc.getString();
804 ColorCode const col =
805 lcolor.getFromLyXName(lyx_name);
806 if (col == Color_none ||
807 col == Color_inherit ||
811 if (!lcolor.setColor(col, x11_name))
812 LYXERR0("Bad lyxrc set_color for " << lyx_name);
816 case RC_AUTOREGIONDELETE:
817 // Auto region delete defaults to true
818 lexrc >> auto_region_delete;
823 lyxpipes = os::internal_path(lexrc.getString());
826 case RC_CURSOR_FOLLOWS_SCROLLBAR:
827 lexrc >> cursor_follows_scrollbar;
830 case RC_CURSOR_WIDTH:
831 lexrc >> cursor_width;
834 case RC_SCROLL_BELOW_DOCUMENT:
835 lexrc >> scroll_below_document;
838 case RC_PARAGRAPH_MARKERS:
839 lexrc >> paragraph_markers;
842 case RC_MAC_DONTSWAP_CTRL_META:
843 lexrc >> mac_dontswap_ctrl_meta;
846 case RC_MAC_LIKE_CURSOR_MOVEMENT:
847 lexrc >> mac_like_cursor_movement;
850 case RC_MACRO_EDIT_STYLE:
852 switch (lexrc.getInteger()) {
853 case 0: macro_edit_style = MACRO_EDIT_INLINE_BOX; break;
854 case 1: macro_edit_style = MACRO_EDIT_INLINE; break;
855 case 2: macro_edit_style = MACRO_EDIT_LIST; break;
860 case RC_DIALOGS_ICONIFY_WITH_MAIN:
861 lexrc >> dialogs_iconify_with_main;
864 case RC_PLAINTEXT_LINELEN:
865 lexrc >> plaintext_linelen;
867 // Spellchecker settings:
868 case RC_ACCEPT_COMPOUND:
869 lexrc >> spellchecker_accept_compound;
871 case RC_USE_NATIVE_FILEDIALOG:
872 lexrc >> use_native_filedialog;
874 case RC_USE_SYSTEM_COLORS:
875 lexrc >> use_system_colors;
878 lexrc >> use_tooltip;
880 case RC_SPELLCHECKER:
881 lexrc >> spellchecker;
884 lexrc >> spellchecker_alt_lang;
887 lexrc >> spellchecker_esc_chars;
889 case RC_SPELLCHECK_CONTINUOUSLY:
890 lexrc >> spellcheck_continuously;
892 case RC_SPELLCHECK_NOTES:
893 lexrc >> spellcheck_notes;
896 lexrc >> make_backup;
898 case RC_SAVE_COMPRESSED:
899 lexrc >> save_compressed;
902 lexrc >> save_origin;
904 case RC_BACKUPDIR_PATH:
906 backupdir_path = os::internal_path(lexrc.getString());
908 case RC_DEFAULT_DECIMAL_POINT:
909 lexrc >> default_decimal_point;
911 case RC_DEFAULT_LENGTH_UNIT:
913 default_length_unit = (Length::UNIT) lexrc.getInteger();
915 case RC_LANGUAGE_CUSTOM_PACKAGE:
916 lexrc >> language_custom_package;
918 case RC_LANGUAGE_AUTO_BEGIN:
919 lexrc >> language_auto_begin;
921 case RC_LANGUAGE_AUTO_END:
922 lexrc >> language_auto_end;
924 case RC_LANGUAGE_GLOBAL_OPTIONS:
925 lexrc >> language_global_options;
927 case RC_LANGUAGE_PACKAGE_SELECTION:
929 switch (lexrc.getInteger()) {
931 language_package_selection = LP_AUTO;
934 language_package_selection = LP_BABEL;
937 language_package_selection = LP_CUSTOM;
940 language_package_selection = LP_NONE;
945 case RC_LANGUAGE_COMMAND_BEGIN:
946 lexrc >> language_command_begin;
948 case RC_LANGUAGE_COMMAND_END:
949 lexrc >> language_command_end;
951 case RC_LANGUAGE_COMMAND_LOCAL:
952 lexrc >> language_command_local;
954 case RC_VISUAL_CURSOR:
955 lexrc >> visual_cursor;
957 case RC_CLOSE_BUFFER_WITH_LAST_VIEW:
958 lexrc >> close_buffer_with_last_view;
961 lexrc >> auto_number;
963 case RC_MARK_FOREIGN_LANGUAGE:
964 lexrc >> mark_foreign_language;
970 fmt = lexrc.getString();
971 if (lexrc.next(true))
972 command = lexrc.getString();
973 setMover(fmt, command);
978 string from, to, command, flags;
980 from = lexrc.getString();
982 to = lexrc.getString();
983 if (lexrc.next(true))
984 command = lexrc.getString();
986 flags = lexrc.getString();
988 theConverters().erase(from, to);
990 theConverters().add(from, to, command, flags);
993 // compatibility with versions older than 1.4.0 only
995 string format, command;
996 lexrc >> format >> command;
997 theFormats().setViewer(format, command);
1000 case RC_FILEFORMAT: {
1002 string format, extensions, shortcut;
1003 docstring prettyname;
1004 if (!(lexrc >> format >> extensions))
1006 if (ok && lexrc.next(true))
1007 prettyname = lexrc.getDocString();
1011 if(!(lexrc >> shortcut))
1013 string viewer, editor;
1014 if (ok && lexrc.next(true))
1015 viewer = lexrc.getString();
1018 if (ok && lexrc.next(true))
1019 editor = lexrc.getString();
1023 if (!(lexrc >> flags >> mime))
1025 int flgs = Format::none;
1026 while (!flags.empty()) {
1028 flags = split(flags, flag, ',');
1029 if (flag == "document")
1030 flgs |= Format::document;
1031 else if (flag == "vector")
1032 flgs |= Format::vector;
1033 else if (flag == "zipped=native")
1034 flgs |= Format::zipped_native;
1035 else if (flag == "menu=export")
1036 flgs |= Format::export_menu;
1038 LYXERR0("Ignoring unknown flag `"
1039 << flag << "' for format `"
1043 LYXERR0("Syntax error in format " << format);
1044 else if (prettyname.empty()) {
1045 if (theConverters().formatIsUsed(format))
1046 LYXERR0("Can't delete format " << format);
1048 theFormats().erase(format);
1050 theFormats().add(format, extensions, prettyname,
1051 shortcut, viewer, editor, mime, flgs);
1055 case RC_VIEWER_ALTERNATIVES: {
1056 string format, command;
1057 if ((lexrc >> format) && lexrc.next(true)) {
1058 command = lexrc.getString();
1059 viewer_alternatives[format].insert(command);
1063 case RC_EDITOR_ALTERNATIVES: {
1064 string format, command;
1065 if ((lexrc >> format) && lexrc.next(true)) {
1066 command = lexrc.getString();
1067 editor_alternatives[format].insert(command);
1072 case RC_DEFAULT_OTF_VIEW_FORMAT:
1073 lexrc >> default_otf_view_format;
1076 case RC_DEFAULT_PLATEX_VIEW_FORMAT:
1077 lexrc >> default_platex_view_format;
1080 case RC_DEFAULT_VIEW_FORMAT:
1081 lexrc >> default_view_format;
1084 case RC_GUI_LANGUAGE:
1085 lexrc >> gui_language;
1088 case RC_SHOW_BANNER:
1089 lexrc >> show_banner;
1094 string const tmp = lexrc.getString();
1095 if (tmp == "true" || tmp == "on")
1096 preview = PREVIEW_ON;
1097 else if (tmp == "no_math")
1098 preview = PREVIEW_NO_MATH;
1100 preview = PREVIEW_OFF;
1101 if (tmp != "false" && tmp != "off")
1102 LYXERR0("Unrecognized preview status \""
1108 case RC_PREVIEW_HASHED_LABELS:
1109 lexrc >> preview_hashed_labels;
1112 case RC_PREVIEW_SCALE_FACTOR:
1113 lexrc >> preview_scale_factor;
1120 lexrc >> user_email;
1123 case RC_PATH_PREFIX:
1124 lexrc >> path_prefix;
1127 case RC_USE_CONVERTER_CACHE:
1128 lexrc >> use_converter_cache;
1130 case RC_USE_CONVERTER_NEEDAUTH_FORBIDDEN:
1131 lexrc >> use_converter_needauth_forbidden;
1133 case RC_USE_CONVERTER_NEEDAUTH:
1134 lexrc >> use_converter_needauth;
1136 case RC_CONVERTER_CACHE_MAXAGE:
1137 lexrc >> converter_cache_maxage;
1140 case RC_SORT_LAYOUTS:
1141 lexrc >> sort_layouts;
1143 case RC_GROUP_LAYOUTS:
1144 lexrc >> group_layouts;
1146 case RC_FULL_SCREEN_LIMIT:
1147 lexrc >> full_screen_limit;
1149 case RC_FULL_SCREEN_TOOLBARS:
1150 lexrc >> full_screen_toolbars;
1152 case RC_FULL_SCREEN_SCROLLBAR:
1153 lexrc >> full_screen_scrollbar;
1155 case RC_FULL_SCREEN_STATUSBAR:
1156 lexrc >> full_screen_statusbar;
1158 case RC_FULL_SCREEN_TABBAR:
1159 lexrc >> full_screen_tabbar;
1161 case RC_FULL_SCREEN_MENUBAR:
1162 lexrc >> full_screen_menubar;
1164 case RC_FULL_SCREEN_WIDTH:
1165 lexrc >> full_screen_width;
1167 case RC_OPEN_BUFFERS_IN_TABS:
1168 lexrc >> open_buffers_in_tabs;
1170 case RC_SINGLE_CLOSE_TAB_BUTTON:
1171 lexrc >> single_close_tab_button;
1173 case RC_SINGLE_INSTANCE:
1174 lexrc >> single_instance;
1175 if (run_mode == PREFERRED)
1176 run_mode = single_instance ? USE_REMOTE : NEW_INSTANCE;
1178 case RC_FORWARD_SEARCH_DVI:
1179 if (lexrc.next(true))
1180 forward_search_dvi = lexrc.getString();
1182 case RC_FORWARD_SEARCH_PDF:
1183 if (lexrc.next(true))
1184 forward_search_pdf = lexrc.getString();
1186 case RC_EXPORT_OVERWRITE:
1188 string const tmp = lexrc.getString();
1189 if (tmp == "all" || tmp == "true")
1190 export_overwrite = ALL_FILES;
1191 else if (tmp == "main")
1192 export_overwrite = MAIN_FILE;
1194 export_overwrite = NO_FILES;
1195 if (tmp != "ask" && tmp != "false")
1196 LYXERR0("Unrecognized export_overwrite status \""
1201 case RC_SCROLL_WHEEL_ZOOM:
1203 string const tmp = lexrc.getString();
1205 scroll_wheel_zoom = SCROLL_WHEEL_ZOOM_CTRL;
1206 else if (tmp == "shift")
1207 scroll_wheel_zoom = SCROLL_WHEEL_ZOOM_SHIFT;
1208 else if (tmp == "alt")
1209 scroll_wheel_zoom = SCROLL_WHEEL_ZOOM_ALT;
1211 scroll_wheel_zoom = SCROLL_WHEEL_ZOOM_OFF;
1212 if (tmp != "off" && tmp != "false")
1213 LYXERR0("Unrecognized scroll_wheel_zoom status \""
1219 case RC_MOUSE_MIDDLEBUTTON_PASTE:
1220 lexrc >> mouse_middlebutton_paste;
1224 break; // this is just a dummy
1227 // This is triggered the first time through the loop unless
1228 // we hit a format tag.
1229 if (check_format && rc_format != LYXRC_FILEFORMAT)
1230 return FormatMismatch;
1233 /// Update converters data-structures
1234 theConverters().update(theFormats());
1235 theConverters().buildGraph();
1236 theBufferList().invalidateConverterCache();
1242 void LyXRC::write(FileName const & filename, bool ignore_system_lyxrc) const
1244 ofstream ofs(filename.toFilesystemEncoding().c_str());
1246 write(ofs, ignore_system_lyxrc);
1250 void LyXRC::print() const
1252 if (lyxerr.debugging())
1253 write(lyxerr, false);
1261 typedef pair<string, SpecialisedMover> Data;
1263 SameMover(Data const & comparison)
1264 : comparison_(comparison) {}
1266 bool operator()(Data const & data) const
1268 return data.first == comparison_.first &&
1269 data.second.command() == comparison_.second.command();
1279 // Escape \ and " so that LyXLex can read the string later
1280 string escapeCommand(string const & str) {
1281 return subst(subst(str , "\\", "\\\\"),
1288 void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) const
1290 LyXRCTags tag = RC_LAST;
1292 if (!name.empty()) {
1293 for (int i = 0; i != lyxrcCount; ++i)
1294 if ("\\" + name == lyxrcTags[i].tag)
1295 tag = static_cast<LyXRCTags>(lyxrcTags[i].code);
1299 os << "# LyX " << lyx_version
1300 << " generated this file. If you want to make your own\n"
1301 << "# modifications you should do them from inside LyX and save.\n\n"
1302 << "Format " << LYXRC_FILEFORMAT << "\n\n";
1304 // Why the switch you might ask. It is a trick to ensure that all
1305 // the elements in the LyXRCTags enum are handled. As you can see
1306 // there are no breaks at all. So it is just a huge fall-through.
1307 // The nice thing is that we will get a warning from the compiler
1308 // if we forget an element.
1312 // input/include files are not done here
1313 case RC_LYXRCFORMAT:
1315 if (ignore_system_lyxrc ||
1316 bind_file != system_lyxrc.bind_file) {
1317 string const path = os::external_path(bind_file);
1318 os << "\\bind_file \"" << path << "\"\n";
1324 if (ignore_system_lyxrc ||
1325 def_file != system_lyxrc.def_file) {
1326 string const path = os::external_path(def_file);
1327 os << "\\def_file \"" << path << "\"\n";
1336 << "# MISC SECTION ######################################\n"
1338 // bind files are not done here.
1340 case RC_PATH_PREFIX:
1341 if (ignore_system_lyxrc ||
1342 path_prefix != system_lyxrc.path_prefix) {
1343 os << "\\path_prefix \"" << path_prefix << "\"\n";
1349 if (ignore_system_lyxrc ||
1350 ui_file != system_lyxrc.ui_file) {
1351 string const path = os::external_path(ui_file);
1352 os << "\\ui_file \"" << path << "\"\n";
1357 case RC_AUTOREGIONDELETE:
1358 if (ignore_system_lyxrc ||
1359 auto_region_delete != system_lyxrc.auto_region_delete) {
1360 os << "# Set to false to inhibit automatic replacement of\n"
1361 << "# the current selection.\n"
1362 << "\\auto_region_delete " << convert<string>(auto_region_delete)
1368 case RC_AUTORESET_OPTIONS:
1369 if (ignore_system_lyxrc ||
1370 auto_reset_options != system_lyxrc.auto_reset_options) {
1371 os << "# Set to false to inhibit automatic reset of\n"
1372 << "# the class options to defaults on class change.\n"
1373 << "\\auto_reset_options "
1374 << convert<string>(auto_reset_options)
1381 if (ignore_system_lyxrc ||
1382 autosave != system_lyxrc.autosave) {
1383 os << "# The time interval between auto-saves in seconds.\n"
1384 << "\\autosave " << autosave << '\n';
1389 case RC_DISPLAY_GRAPHICS:
1390 if (ignore_system_lyxrc ||
1391 display_graphics != system_lyxrc.display_graphics) {
1392 os << "# Display graphics within LyX\n"
1394 << "\\display_graphics "
1395 << (display_graphics ? "true" : "false")
1401 case RC_SORT_LAYOUTS:
1402 if (ignore_system_lyxrc ||
1403 sort_layouts != system_lyxrc.sort_layouts) {
1404 os << "# Sort layouts alphabetically.\n"
1405 << "\\sort_layouts " << convert<string>(sort_layouts) << '\n';
1410 case RC_GROUP_LAYOUTS:
1411 if (ignore_system_lyxrc ||
1412 group_layouts != system_lyxrc.group_layouts) {
1413 os << "# Group layouts by their category.\n"
1414 << "\\group_layouts " << convert<string>(group_layouts) << '\n';
1419 case RC_VIEWDVI_PAPEROPTION:
1420 if (ignore_system_lyxrc ||
1421 view_dvi_paper_option
1422 != system_lyxrc.view_dvi_paper_option) {
1423 os << "# Options used to specify paper size to the\n"
1424 << "# view_dvi_command (e.g. -paper)\n"
1425 << "\\view_dvi_paper_option \""
1426 << view_dvi_paper_option << "\"\n";
1431 case RC_CHKTEX_COMMAND:
1432 if (ignore_system_lyxrc ||
1433 chktex_command != system_lyxrc.chktex_command) {
1434 os << "\\chktex_command \"" << escapeCommand(chktex_command) << "\"\n";
1439 case RC_BIBTEX_ALTERNATIVES: {
1440 CommandSet::const_iterator it = bibtex_alternatives.begin();
1441 CommandSet::const_iterator end = bibtex_alternatives.end();
1442 for ( ; it != end; ++it) {
1443 if (ignore_system_lyxrc
1444 || !system_lyxrc.bibtex_alternatives.count(*it))
1445 os << "\\bibtex_alternatives \""
1452 case RC_BIBTEX_COMMAND:
1453 if (ignore_system_lyxrc ||
1454 bibtex_command != system_lyxrc.bibtex_command) {
1455 os << "\\bibtex_command \"" << escapeCommand(bibtex_command) << "\"\n";
1460 case RC_JBIBTEX_COMMAND:
1461 if (ignore_system_lyxrc ||
1462 jbibtex_command != system_lyxrc.jbibtex_command) {
1463 os << "\\jbibtex_command \"" << escapeCommand(jbibtex_command) << "\"\n";
1468 case RC_JBIBTEX_ALTERNATIVES: {
1469 CommandSet::const_iterator it = jbibtex_alternatives.begin();
1470 CommandSet::const_iterator end = jbibtex_alternatives.end();
1471 for ( ; it != end; ++it) {
1472 if (ignore_system_lyxrc
1473 || !system_lyxrc.jbibtex_alternatives.count(*it))
1474 os << "\\jbibtex_alternatives \""
1481 case RC_INDEX_ALTERNATIVES: {
1482 CommandSet::const_iterator it = index_alternatives.begin();
1483 CommandSet::const_iterator end = index_alternatives.end();
1484 for ( ; it != end; ++it) {
1485 if (ignore_system_lyxrc
1486 || !system_lyxrc.index_alternatives.count(*it))
1487 os << "\\index_alternatives \""
1494 case RC_INDEX_COMMAND:
1495 if (ignore_system_lyxrc ||
1496 index_command != system_lyxrc.index_command) {
1497 os << "\\index_command \"" << escapeCommand(index_command) << "\"\n";
1502 case RC_JINDEX_COMMAND:
1503 if (ignore_system_lyxrc ||
1504 jindex_command != system_lyxrc.jindex_command) {
1505 os << "\\jindex_command \"" << escapeCommand(jindex_command) << "\"\n";
1510 case RC_SPLITINDEX_COMMAND:
1511 if (ignore_system_lyxrc ||
1512 splitindex_command != system_lyxrc.splitindex_command) {
1513 os << "\\splitindex_command \"" << escapeCommand(splitindex_command) << "\"\n";
1518 case RC_NOMENCL_COMMAND:
1519 if (ignore_system_lyxrc ||
1520 nomencl_command != system_lyxrc.nomencl_command) {
1521 os << "\\nomencl_command \"" << escapeCommand(nomencl_command) << "\"\n";
1526 case RC_PYGMENTIZE_COMMAND:
1527 if (ignore_system_lyxrc ||
1528 pygmentize_command != system_lyxrc.pygmentize_command) {
1529 os << "\\pygmentize_command \"" << escapeCommand(pygmentize_command) << "\"\n";
1534 case RC_TEX_EXPECTS_WINDOWS_PATHS:
1535 // Don't write this setting to the preferences file,
1536 // but allow temporary changes (bug 7557).
1537 if (ignore_system_lyxrc) {
1538 os << "\\tex_expects_windows_paths "
1539 << convert<string>(windows_style_tex_paths) << '\n';
1544 case RC_TEX_ALLOWS_SPACES:
1545 if (tex_allows_spaces != system_lyxrc.tex_allows_spaces) {
1546 os << "\\tex_allows_spaces "
1547 << convert<string>(tex_allows_spaces) << '\n';
1553 if (ignore_system_lyxrc ||
1554 use_kbmap != system_lyxrc.use_kbmap) {
1555 os << "\\kbmap " << convert<string>(use_kbmap) << '\n';
1560 case RC_KBMAP_PRIMARY:
1561 if (ignore_system_lyxrc ||
1562 primary_kbmap != system_lyxrc.primary_kbmap) {
1563 string const path = os::external_path(primary_kbmap);
1564 os << "\\kbmap_primary \"" << path << "\"\n";
1569 case RC_KBMAP_SECONDARY:
1570 if (ignore_system_lyxrc ||
1571 secondary_kbmap != system_lyxrc.secondary_kbmap) {
1572 string const path = os::external_path(secondary_kbmap);
1573 os << "\\kbmap_secondary \"" << path << "\"\n";
1579 if (ignore_system_lyxrc ||
1580 lyxpipes != system_lyxrc.lyxpipes) {
1581 string const path = os::external_path(lyxpipes);
1582 os << "\\serverpipe \"" << path << "\"\n";
1588 os << "\\user_name \"" << user_name << "\"\n";
1593 os << "\\user_email \"" << user_email << "\"\n";
1597 case RC_SHOW_BANNER:
1598 if (ignore_system_lyxrc ||
1599 show_banner != system_lyxrc.show_banner) {
1600 os << "\\show_banner " << convert<string>(show_banner) << '\n';
1606 if (ignore_system_lyxrc ||
1607 preview != system_lyxrc.preview) {
1613 case PREVIEW_NO_MATH:
1620 os << "\\preview " << status << '\n';
1625 case RC_PREVIEW_HASHED_LABELS:
1626 if (ignore_system_lyxrc ||
1627 preview_hashed_labels !=
1628 system_lyxrc.preview_hashed_labels) {
1629 os << "\\preview_hashed_labels "
1630 << convert<string>(preview_hashed_labels) << '\n';
1635 case RC_PREVIEW_SCALE_FACTOR:
1636 if (ignore_system_lyxrc ||
1637 preview_scale_factor != system_lyxrc.preview_scale_factor) {
1638 os << "\\preview_scale_factor "
1639 << preview_scale_factor << '\n';
1644 case RC_USE_CONVERTER_CACHE:
1645 if (ignore_system_lyxrc ||
1646 use_converter_cache != system_lyxrc.use_converter_cache) {
1647 os << "\\use_converter_cache "
1648 << convert<string>(use_converter_cache) << '\n';
1653 case RC_USE_CONVERTER_NEEDAUTH_FORBIDDEN:
1654 if (ignore_system_lyxrc ||
1655 use_converter_needauth_forbidden != system_lyxrc.use_converter_needauth_forbidden) {
1656 os << "\\use_converter_needauth_forbidden "
1657 << convert<string>(use_converter_needauth_forbidden) << '\n';
1662 case RC_USE_CONVERTER_NEEDAUTH:
1663 if (ignore_system_lyxrc ||
1664 use_converter_needauth != system_lyxrc.use_converter_needauth) {
1665 os << "\\use_converter_needauth "
1666 << convert<string>(use_converter_needauth) << '\n';
1671 case RC_CONVERTER_CACHE_MAXAGE:
1672 if (ignore_system_lyxrc ||
1673 converter_cache_maxage != system_lyxrc.converter_cache_maxage) {
1674 os << "\\converter_cache_maxage "
1675 << converter_cache_maxage << '\n';
1681 << "# SCREEN & FONTS SECTION ############################\n"
1685 if (ignore_system_lyxrc ||
1686 icon_set != system_lyxrc.icon_set) {
1687 os << "\\icon_set \"" << icon_set
1693 case RC_USE_SYSTEM_THEME_ICONS:
1694 if (ignore_system_lyxrc ||
1695 use_system_theme_icons != system_lyxrc.use_system_theme_icons) {
1696 os << "\\use_system_theme_icons "
1697 << convert<string>(use_system_theme_icons)
1704 if (ignore_system_lyxrc ||
1705 dpi != system_lyxrc.dpi) {
1706 os << "\\screen_dpi " << dpi << '\n';
1711 case RC_SCREEN_ZOOM:
1712 if (ignore_system_lyxrc ||
1713 defaultZoom != system_lyxrc.defaultZoom) {
1714 os << "\\screen_zoom " << defaultZoom << '\n';
1719 case RC_GEOMETRY_SESSION:
1720 if (ignore_system_lyxrc ||
1721 allow_geometry_session != system_lyxrc.allow_geometry_session) {
1722 os << "\\allow_geometry_session " << convert<string>(allow_geometry_session)
1728 case RC_CURSOR_FOLLOWS_SCROLLBAR:
1729 if (ignore_system_lyxrc ||
1730 cursor_follows_scrollbar
1731 != system_lyxrc.cursor_follows_scrollbar) {
1732 os << "\\cursor_follows_scrollbar "
1733 << convert<string>(cursor_follows_scrollbar) << '\n';
1738 case RC_CURSOR_WIDTH:
1739 if (ignore_system_lyxrc ||
1741 != system_lyxrc.cursor_width) {
1742 os << "\\cursor_width "
1743 << cursor_width << '\n';
1748 case RC_SCROLL_BELOW_DOCUMENT:
1749 if (ignore_system_lyxrc ||
1750 scroll_below_document
1751 != system_lyxrc.scroll_below_document) {
1752 os << "\\scroll_below_document "
1753 << convert<string>(scroll_below_document) << '\n';
1758 case RC_PARAGRAPH_MARKERS:
1759 if (ignore_system_lyxrc ||
1761 != system_lyxrc.paragraph_markers) {
1762 os << "\\paragraph_markers "
1763 << convert<string>(paragraph_markers) << '\n';
1768 case RC_MAC_DONTSWAP_CTRL_META:
1769 if (ignore_system_lyxrc ||
1770 mac_dontswap_ctrl_meta
1771 != system_lyxrc.mac_dontswap_ctrl_meta) {
1772 os << "\\mac_dontswap_ctrl_meta "
1773 << convert<string>(mac_dontswap_ctrl_meta) << '\n';
1778 case RC_MAC_LIKE_CURSOR_MOVEMENT:
1779 if (ignore_system_lyxrc ||
1780 mac_like_cursor_movement
1781 != system_lyxrc.mac_like_cursor_movement) {
1782 os << "\\mac_like_cursor_movement "
1783 << convert<string>(mac_like_cursor_movement) << '\n';
1788 case RC_MACRO_EDIT_STYLE:
1789 if (ignore_system_lyxrc ||
1791 != system_lyxrc.macro_edit_style) {
1792 os << "\\macro_edit_style ";
1793 switch (macro_edit_style) {
1794 case MACRO_EDIT_INLINE_BOX: os << "0\n"; break;
1795 case MACRO_EDIT_INLINE: os << "1\n"; break;
1796 case MACRO_EDIT_LIST: os << "2\n"; break;
1802 case RC_DIALOGS_ICONIFY_WITH_MAIN:
1803 if (ignore_system_lyxrc ||
1804 dialogs_iconify_with_main
1805 != system_lyxrc.dialogs_iconify_with_main) {
1806 os << "\\dialogs_iconify_with_main "
1807 << convert<string>(dialogs_iconify_with_main) << '\n';
1812 case RC_SCREEN_FONT_ROMAN:
1813 if (ignore_system_lyxrc ||
1814 roman_font_name != system_lyxrc.roman_font_name) {
1815 os << "\\screen_font_roman \"" << roman_font_name
1821 case RC_SCREEN_FONT_ROMAN_FOUNDRY:
1822 if (ignore_system_lyxrc ||
1823 roman_font_foundry != system_lyxrc.roman_font_foundry) {
1824 os << "\\screen_font_roman_foundry \"" << roman_font_foundry
1830 case RC_SCREEN_FONT_SANS:
1831 if (ignore_system_lyxrc ||
1832 sans_font_name != system_lyxrc.sans_font_name) {
1833 os << "\\screen_font_sans \"" << sans_font_name
1839 case RC_SCREEN_FONT_SANS_FOUNDRY:
1840 if (ignore_system_lyxrc ||
1841 sans_font_foundry != system_lyxrc.sans_font_foundry) {
1842 os << "\\screen_font_sans_foundry \"" << sans_font_foundry
1848 case RC_SCREEN_FONT_TYPEWRITER:
1849 if (ignore_system_lyxrc ||
1850 typewriter_font_name != system_lyxrc.typewriter_font_name) {
1851 os << "\\screen_font_typewriter \""
1852 << typewriter_font_name << "\"\n";
1857 case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
1858 if (ignore_system_lyxrc ||
1859 typewriter_font_foundry != system_lyxrc.typewriter_font_foundry) {
1860 os << "\\screen_font_typewriter_foundry \""
1861 << typewriter_font_foundry << "\"\n";
1866 case RC_SCREEN_FONT_SCALABLE:
1867 if (ignore_system_lyxrc ||
1868 use_scalable_fonts != system_lyxrc.use_scalable_fonts) {
1869 os << "\\screen_font_scalable "
1870 << convert<string>(use_scalable_fonts)
1876 case RC_SCREEN_FONT_SIZES:
1877 if (ignore_system_lyxrc ||
1878 font_sizes[FONT_SIZE_TINY]
1879 != system_lyxrc.font_sizes[FONT_SIZE_TINY] ||
1880 font_sizes[FONT_SIZE_SCRIPT]
1881 != system_lyxrc.font_sizes[FONT_SIZE_SCRIPT] ||
1882 font_sizes[FONT_SIZE_FOOTNOTE]
1883 != system_lyxrc.font_sizes[FONT_SIZE_FOOTNOTE] ||
1884 font_sizes[FONT_SIZE_SMALL]
1885 != system_lyxrc.font_sizes[FONT_SIZE_SMALL] ||
1886 font_sizes[FONT_SIZE_NORMAL]
1887 != system_lyxrc.font_sizes[FONT_SIZE_NORMAL] ||
1888 font_sizes[FONT_SIZE_LARGE]
1889 != system_lyxrc.font_sizes[FONT_SIZE_LARGE] ||
1890 font_sizes[FONT_SIZE_LARGER]
1891 != system_lyxrc.font_sizes[FONT_SIZE_LARGER] ||
1892 font_sizes[FONT_SIZE_LARGEST]
1893 != system_lyxrc.font_sizes[FONT_SIZE_LARGEST] ||
1894 font_sizes[FONT_SIZE_HUGE]
1895 != system_lyxrc.font_sizes[FONT_SIZE_HUGE] ||
1896 font_sizes[FONT_SIZE_HUGER]
1897 != system_lyxrc.font_sizes[FONT_SIZE_HUGER]) {
1898 streamsize old_prec = os.precision();
1899 os.setf(ios::fixed);
1901 os << "\\screen_font_sizes"
1902 << ' ' << font_sizes[FONT_SIZE_TINY]
1903 << ' ' << font_sizes[FONT_SIZE_SCRIPT]
1904 << ' ' << font_sizes[FONT_SIZE_FOOTNOTE]
1905 << ' ' << font_sizes[FONT_SIZE_SMALL]
1906 << ' ' << font_sizes[FONT_SIZE_NORMAL]
1907 << ' ' << font_sizes[FONT_SIZE_LARGE]
1908 << ' ' << font_sizes[FONT_SIZE_LARGER]
1909 << ' ' << font_sizes[FONT_SIZE_LARGEST]
1910 << ' ' << font_sizes[FONT_SIZE_HUGE]
1911 << ' ' << font_sizes[FONT_SIZE_HUGER]
1913 os.precision(old_prec);
1914 os.unsetf(ios::fixed);
1919 case RC_FULL_SCREEN_LIMIT:
1920 if (ignore_system_lyxrc ||
1921 full_screen_limit != system_lyxrc.full_screen_limit) {
1922 os << "\\fullscreen_limit "
1923 << convert<string>(full_screen_limit)
1929 case RC_FULL_SCREEN_TOOLBARS:
1930 if (ignore_system_lyxrc ||
1931 full_screen_toolbars != system_lyxrc.full_screen_toolbars) {
1932 os << "\\fullscreen_toolbars "
1933 << convert<string>(full_screen_toolbars)
1939 case RC_FULL_SCREEN_SCROLLBAR:
1940 if (ignore_system_lyxrc ||
1941 full_screen_scrollbar != system_lyxrc.full_screen_scrollbar) {
1942 os << "\\fullscreen_scrollbar "
1943 << convert<string>(full_screen_scrollbar)
1949 case RC_FULL_SCREEN_STATUSBAR:
1950 if (ignore_system_lyxrc ||
1951 full_screen_statusbar != system_lyxrc.full_screen_statusbar) {
1952 os << "\\fullscreen_statusbar "
1953 << convert<string>(full_screen_statusbar)
1959 case RC_FULL_SCREEN_TABBAR:
1960 if (ignore_system_lyxrc ||
1961 full_screen_tabbar != system_lyxrc.full_screen_tabbar) {
1962 os << "\\fullscreen_tabbar "
1963 << convert<string>(full_screen_tabbar)
1969 case RC_FULL_SCREEN_MENUBAR:
1970 if (ignore_system_lyxrc ||
1971 full_screen_menubar != system_lyxrc.full_screen_menubar) {
1972 os << "\\fullscreen_menubar "
1973 << convert<string>(full_screen_menubar)
1979 case RC_FULL_SCREEN_WIDTH:
1980 if (ignore_system_lyxrc ||
1981 full_screen_width != system_lyxrc.full_screen_width) {
1982 os << "\\fullscreen_width "
1983 << convert<string>(full_screen_width)
1989 case RC_OPEN_BUFFERS_IN_TABS:
1990 if (ignore_system_lyxrc ||
1991 open_buffers_in_tabs != system_lyxrc.open_buffers_in_tabs) {
1992 os << "\\open_buffers_in_tabs "
1993 << convert<string>(open_buffers_in_tabs)
1999 case RC_SINGLE_CLOSE_TAB_BUTTON:
2000 if (ignore_system_lyxrc ||
2001 single_close_tab_button != system_lyxrc.single_close_tab_button) {
2002 os << "\\single_close_tab_button "
2003 << 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)
2019 case RC_FORWARD_SEARCH_DVI:
2020 if (ignore_system_lyxrc ||
2021 forward_search_dvi != system_lyxrc.forward_search_dvi) {
2022 os << "\\forward_search_dvi \"" << escapeCommand(forward_search_dvi) << "\"\n";
2027 case RC_FORWARD_SEARCH_PDF:
2028 if (ignore_system_lyxrc ||
2029 forward_search_pdf != system_lyxrc.forward_search_pdf) {
2030 os << "\\forward_search_pdf \"" << escapeCommand(forward_search_pdf) << "\"\n";
2036 << "# COLOR SECTION ###################################\n"
2041 for (int i = 0; i < Color_ignore; ++i) {
2042 ColorCode lc = static_cast<ColorCode>(i);
2043 string const col = lcolor.getX11Name(lc);
2044 if (ignore_system_lyxrc
2045 || col != system_lcolor.getX11Name(lc)) {
2046 os << "\\set_color \""
2047 << lcolor.getLyXName(lc) << "\" \""
2055 << "# PRINTER SECTION ###################################\n"
2059 case RC_PRINTLANDSCAPEFLAG:
2060 if (ignore_system_lyxrc ||
2061 print_landscape_flag != system_lyxrc.print_landscape_flag) {
2062 os << "\\print_landscape_flag \"" << print_landscape_flag
2068 case RC_PRINTPAPERFLAG:
2069 if (ignore_system_lyxrc ||
2070 print_paper_flag != system_lyxrc.print_paper_flag) {
2071 os << "\\print_paper_flag \"" << print_paper_flag
2077 case RC_PRINTPAPERDIMENSIONFLAG:
2078 if (ignore_system_lyxrc ||
2079 print_paper_dimension_flag
2080 != system_lyxrc.print_paper_dimension_flag) {
2081 os << "\\print_paper_dimension_flag \""
2082 << print_paper_dimension_flag << "\"\n";
2088 << "# TEX SECTION #######################################\n"
2092 case RC_TEXINPUTS_PREFIX:
2093 if (ignore_system_lyxrc ||
2094 texinputs_prefix != system_lyxrc.texinputs_prefix) {
2095 os << "\\texinputs_prefix \"" << texinputs_prefix << "\"\n";
2101 << "# FILE SECTION ######################################\n"
2104 case RC_DOCUMENTPATH:
2105 if (ignore_system_lyxrc ||
2106 document_path != system_lyxrc.document_path) {
2107 string const path = os::external_path(document_path);
2108 os << "\\document_path \"" << path << "\"\n";
2113 case RC_USELASTFILEPOS:
2114 if (ignore_system_lyxrc ||
2115 use_lastfilepos != system_lyxrc.use_lastfilepos) {
2116 os << "\\use_lastfilepos " << convert<string>(use_lastfilepos)
2122 case RC_LOADSESSION:
2123 if (ignore_system_lyxrc ||
2124 load_session != system_lyxrc.load_session) {
2125 os << "\\load_session " << convert<string>(load_session)
2131 case RC_MOUSE_WHEEL_SPEED:
2132 if (ignore_system_lyxrc ||
2133 mouse_wheel_speed != system_lyxrc.mouse_wheel_speed) {
2134 os << "\\mouse_wheel_speed " << mouse_wheel_speed << '\n';
2139 case RC_MOUSE_MIDDLEBUTTON_PASTE:
2140 if (ignore_system_lyxrc ||
2141 mouse_middlebutton_paste != system_lyxrc.mouse_middlebutton_paste) {
2142 os << "\\mouse_middlebutton_paste "
2143 << convert<string>(mouse_middlebutton_paste) << '\n';
2148 case RC_COMPLETION_INLINE_DELAY:
2149 if (ignore_system_lyxrc ||
2150 completion_inline_delay != system_lyxrc.completion_inline_delay) {
2151 os << "\\completion_inline_delay " << completion_inline_delay << '\n';
2156 case RC_COMPLETION_INLINE_MATH:
2157 if (ignore_system_lyxrc ||
2158 completion_inline_math != system_lyxrc.completion_inline_math) {
2159 os << "\\completion_inline_math "
2160 << convert<string>(completion_inline_math) << '\n';
2165 case RC_COMPLETION_INLINE_TEXT:
2166 if (ignore_system_lyxrc ||
2167 completion_inline_text != system_lyxrc.completion_inline_text) {
2168 os << "\\completion_inline_text "
2169 << convert<string>(completion_inline_text) << '\n';
2174 case RC_COMPLETION_INLINE_DOTS:
2175 if (ignore_system_lyxrc ||
2176 completion_inline_dots != system_lyxrc.completion_inline_dots) {
2177 os << "\\completion_inline_dots "
2178 << convert<string>(completion_inline_dots) << '\n';
2183 case RC_AUTOCORRECTION_MATH:
2184 if (ignore_system_lyxrc ||
2185 autocorrection_math != system_lyxrc.autocorrection_math) {
2186 os << "\\autocorrection_math "
2187 << convert<string>(autocorrection_math) << '\n';
2192 case RC_COMPLETION_POPUP_DELAY:
2193 if (ignore_system_lyxrc ||
2194 completion_popup_delay != system_lyxrc.completion_popup_delay) {
2195 os << "\\completion_popup_delay " << completion_popup_delay << '\n';
2200 case RC_COMPLETION_POPUP_MATH:
2201 if (ignore_system_lyxrc ||
2202 completion_popup_math != system_lyxrc.completion_popup_math) {
2203 os << "\\completion_popup_math "
2204 << convert<string>(completion_popup_math) << '\n';
2209 case RC_COMPLETION_POPUP_TEXT:
2210 if (ignore_system_lyxrc ||
2211 completion_popup_text != system_lyxrc.completion_popup_text) {
2212 os << "\\completion_popup_text "
2213 << convert<string>(completion_popup_text) << '\n';
2218 case RC_COMPLETION_CURSOR_TEXT:
2219 if (ignore_system_lyxrc ||
2220 completion_cursor_text != system_lyxrc.completion_cursor_text) {
2221 os << "\\completion_cursor_text "
2222 << convert<string>(completion_cursor_text) << '\n';
2227 case RC_COMPLETION_POPUP_AFTER_COMPLETE:
2228 if (ignore_system_lyxrc ||
2229 completion_popup_after_complete
2230 != system_lyxrc.completion_popup_after_complete) {
2231 os << "\\completion_popup_after_complete "
2232 << convert<string>(completion_popup_after_complete) << '\n';
2237 case RC_COMPLETION_MINLENGTH:
2238 if (ignore_system_lyxrc ||
2239 completion_minlength != system_lyxrc.completion_minlength) {
2240 os << "\\completion_minlength " << convert<string>(completion_minlength)
2246 case RC_NUMLASTFILES:
2247 if (ignore_system_lyxrc ||
2248 num_lastfiles != system_lyxrc.num_lastfiles) {
2249 os << "\\num_lastfiles " << num_lastfiles << '\n';
2254 case RC_CHECKLASTFILES:
2255 if (ignore_system_lyxrc ||
2256 check_lastfiles != system_lyxrc.check_lastfiles) {
2257 os << "\\check_lastfiles " << convert<string>(check_lastfiles)
2263 case RC_EXAMPLEPATH:
2264 if (ignore_system_lyxrc ||
2265 example_path != system_lyxrc.example_path) {
2266 string const path = os::external_path(example_path);
2267 os << "\\example_path \"" << path << "\"\n";
2272 case RC_TEMPLATEPATH:
2273 if (ignore_system_lyxrc ||
2274 template_path != system_lyxrc.template_path) {
2275 string const path = os::external_path(template_path);
2276 os << "\\template_path \"" << path << "\"\n";
2281 case RC_TEMPDIRPATH:
2282 if (ignore_system_lyxrc ||
2283 tempdir_path != system_lyxrc.tempdir_path) {
2284 string const path = os::external_path(tempdir_path);
2285 os << "\\tempdir_path \"" << path << "\"\n";
2290 case RC_THESAURUSDIRPATH:
2291 if (ignore_system_lyxrc ||
2292 thesaurusdir_path != system_lyxrc.thesaurusdir_path) {
2293 string const path = os::external_path(thesaurusdir_path);
2294 os << "\\thesaurusdir_path \"" << path << "\"\n";
2299 case RC_HUNSPELLDIR_PATH:
2300 if (ignore_system_lyxrc ||
2301 hunspelldir_path != system_lyxrc.hunspelldir_path) {
2302 string const path = os::external_path(hunspelldir_path);
2303 os << "\\hunspelldir_path \"" << path << "\"\n";
2308 case RC_PLAINTEXT_LINELEN:
2309 if (ignore_system_lyxrc ||
2310 plaintext_linelen != system_lyxrc.plaintext_linelen) {
2311 os << "\\plaintext_linelen " << plaintext_linelen << '\n';
2316 case RC_MAKE_BACKUP:
2317 if (ignore_system_lyxrc ||
2318 make_backup != system_lyxrc.make_backup) {
2319 os << "\\make_backup " << convert<string>(make_backup) << '\n';
2324 case RC_SAVE_COMPRESSED:
2325 if (ignore_system_lyxrc ||
2326 save_compressed != system_lyxrc.save_compressed) {
2327 os << "\\save_compressed " << convert<string>(save_compressed) << '\n';
2332 case RC_SAVE_ORIGIN:
2333 if (ignore_system_lyxrc ||
2334 save_origin != system_lyxrc.save_origin) {
2335 os << "\\save_origin " << convert<string>(save_origin) << '\n';
2340 case RC_BACKUPDIR_PATH:
2341 if (ignore_system_lyxrc ||
2342 backupdir_path != system_lyxrc.backupdir_path) {
2343 string const path = os::external_path(backupdir_path);
2344 os << "\\backupdir_path \"" << path << "\"\n";
2350 << "# PLAIN TEXT EXPORT SECTION ##############################\n"
2354 << "# SPELLCHECKER SECTION ##############################\n"
2358 case RC_ACCEPT_COMPOUND:
2359 if (ignore_system_lyxrc ||
2360 spellchecker_accept_compound != system_lyxrc.spellchecker_accept_compound) {
2361 os << "\\accept_compound " << convert<string>(spellchecker_accept_compound)
2368 if (ignore_system_lyxrc ||
2369 spellchecker_alt_lang != system_lyxrc.spellchecker_alt_lang) {
2370 os << "\\alternate_language \"" << spellchecker_alt_lang
2377 if (ignore_system_lyxrc ||
2378 spellchecker_esc_chars != system_lyxrc.spellchecker_esc_chars) {
2379 os << "\\escape_chars \"" << spellchecker_esc_chars << "\"\n";
2384 case RC_USE_NATIVE_FILEDIALOG:
2385 if (ignore_system_lyxrc ||
2386 use_native_filedialog != system_lyxrc.use_native_filedialog) {
2387 os << "\\use_native_filedialog "
2388 << convert<string>(use_native_filedialog)
2394 case RC_USE_SYSTEM_COLORS:
2395 if (ignore_system_lyxrc ||
2396 use_system_colors != system_lyxrc.use_system_colors) {
2397 os << "\\use_system_colors "
2398 << convert<string>(use_system_colors)
2404 case RC_USE_TOOLTIP:
2405 if (ignore_system_lyxrc ||
2406 use_tooltip != system_lyxrc.use_tooltip) {
2407 os << "\\use_tooltip "
2408 << convert<string>(use_tooltip)
2416 << "# LANGUAGE SUPPORT SECTION ##########################\n"
2420 case RC_DEFAULT_DECIMAL_POINT:
2421 if (ignore_system_lyxrc ||
2422 default_decimal_point != system_lyxrc.default_decimal_point) {
2423 os << "\\default_decimal_point " << default_decimal_point << '\n';
2428 case RC_DEFAULT_LENGTH_UNIT:
2429 if (ignore_system_lyxrc ||
2430 default_length_unit != system_lyxrc.default_length_unit) {
2431 os << "\\default_length_unit " << int(default_length_unit) << '\n';
2436 case RC_SPELLCHECKER:
2437 if (ignore_system_lyxrc ||
2438 spellchecker != system_lyxrc.spellchecker) {
2439 os << "\\spellchecker " << spellchecker << '\n';
2444 case RC_SPELLCHECK_CONTINUOUSLY:
2445 if (ignore_system_lyxrc ||
2446 spellcheck_continuously != system_lyxrc.spellcheck_continuously) {
2447 os << "\\spellcheck_continuously " << convert<string>(spellcheck_continuously)
2453 case RC_SPELLCHECK_NOTES:
2454 if (ignore_system_lyxrc ||
2455 spellcheck_notes != system_lyxrc.spellcheck_notes) {
2456 os << "\\spellcheck_notes " << convert<string>(spellcheck_notes)
2462 case RC_VISUAL_CURSOR:
2463 if (ignore_system_lyxrc ||
2464 visual_cursor != system_lyxrc.visual_cursor) {
2465 os << "\\visual_cursor " << convert<string>(visual_cursor) << '\n';
2470 case RC_CLOSE_BUFFER_WITH_LAST_VIEW:
2471 if (ignore_system_lyxrc ||
2472 close_buffer_with_last_view != system_lyxrc.close_buffer_with_last_view) {
2473 os << "# When closing last view, buffer closes (yes), hides (no), or ask the user (ask)\n";
2474 os << "\\close_buffer_with_last_view " << close_buffer_with_last_view << '\n';
2479 case RC_LANGUAGE_CUSTOM_PACKAGE:
2480 if (ignore_system_lyxrc ||
2481 language_custom_package != system_lyxrc.language_custom_package) {
2482 os << "\\language_custom_package \"" << language_custom_package
2488 case RC_LANGUAGE_GLOBAL_OPTIONS:
2489 if (ignore_system_lyxrc ||
2490 language_global_options
2491 != system_lyxrc.language_global_options) {
2492 os << "\\language_global_options \""
2493 << convert<string>(language_global_options)
2499 case RC_LANGUAGE_PACKAGE_SELECTION:
2500 if (ignore_system_lyxrc ||
2501 language_package_selection != system_lyxrc.language_package_selection) {
2502 os << "\\language_package_selection ";
2503 switch (language_package_selection) {
2521 case RC_LANGUAGE_COMMAND_BEGIN:
2522 if (ignore_system_lyxrc ||
2523 language_command_begin
2524 != system_lyxrc.language_command_begin) {
2525 os << "\\language_command_begin \""
2526 << language_command_begin
2532 case RC_LANGUAGE_COMMAND_END:
2533 if (ignore_system_lyxrc ||
2534 language_command_end
2535 != system_lyxrc.language_command_end) {
2536 os << "\\language_command_end \"" << language_command_end
2542 case RC_LANGUAGE_COMMAND_LOCAL:
2543 if (ignore_system_lyxrc ||
2544 language_command_local
2545 != system_lyxrc.language_command_local) {
2546 os << "\\language_command_local \""
2547 << language_command_local
2553 case RC_LANGUAGE_AUTO_BEGIN:
2554 if (ignore_system_lyxrc ||
2555 language_auto_begin != system_lyxrc.language_auto_begin) {
2556 os << "\\language_auto_begin "
2557 << convert<string>(language_auto_begin) << '\n';
2562 case RC_LANGUAGE_AUTO_END:
2563 if (ignore_system_lyxrc ||
2564 language_auto_end != system_lyxrc.language_auto_end) {
2565 os << "\\language_auto_end "
2566 << convert<string>(language_auto_end) << '\n';
2571 case RC_MARK_FOREIGN_LANGUAGE:
2572 if (ignore_system_lyxrc ||
2573 mark_foreign_language
2574 != system_lyxrc.mark_foreign_language) {
2575 os << "\\mark_foreign_language " <<
2576 convert<string>(mark_foreign_language) << '\n';
2582 << "# 2nd MISC SUPPORT SECTION ##########################\n"
2586 case RC_AUTO_NUMBER:
2587 if (ignore_system_lyxrc ||
2588 auto_number != system_lyxrc.auto_number) {
2589 os << "\\auto_number " << convert<string>(auto_number) << '\n';
2594 case RC_GUI_LANGUAGE:
2595 if (ignore_system_lyxrc ||
2596 gui_language != system_lyxrc.gui_language) {
2597 os << "\\gui_language " << gui_language << '\n';
2602 case RC_EXPORT_OVERWRITE:
2603 if (ignore_system_lyxrc ||
2604 export_overwrite != system_lyxrc.export_overwrite) {
2606 switch (export_overwrite) {
2617 os << "\\export_overwrite " << status << '\n';
2622 case RC_SCROLL_WHEEL_ZOOM:
2623 if (ignore_system_lyxrc ||
2624 scroll_wheel_zoom != system_lyxrc.scroll_wheel_zoom) {
2626 switch (scroll_wheel_zoom) {
2627 case SCROLL_WHEEL_ZOOM_OFF:
2630 case SCROLL_WHEEL_ZOOM_CTRL:
2633 case SCROLL_WHEEL_ZOOM_SHIFT:
2636 case SCROLL_WHEEL_ZOOM_ALT:
2640 os << "\\scroll_wheel_zoom " << status << '\n';
2646 << "# FORMATS SECTION ##########################\n"
2651 // New/modified formats
2652 for (Formats::const_iterator cit = theFormats().begin();
2653 cit != theFormats().end(); ++cit) {
2654 Format const * format =
2655 theSystemFormats().getFormat(cit->name());
2657 format->extensions() != cit->extensions() ||
2658 format->prettyname() != cit->prettyname() ||
2659 format->shortcut() != cit->shortcut() ||
2660 format->viewer() != cit->viewer() ||
2661 format->editor() != cit->editor() ||
2662 format->documentFormat() != cit->documentFormat() ||
2663 format->vectorFormat() != cit->vectorFormat() ||
2664 format->inExportMenu() != cit->inExportMenu() ||
2665 format->mime() != cit->mime()) {
2666 os << "\\format \"" << cit->name() << "\" \""
2667 << cit->extensions() << "\" \""
2668 << to_utf8(cit->prettyname()) << "\" \""
2669 << cit->shortcut() << "\" \""
2670 << escapeCommand(cit->viewer()) << "\" \""
2671 << escapeCommand(cit->editor()) << "\" \"";
2672 vector<string> flags;
2673 if (cit->documentFormat())
2674 flags.push_back("document");
2675 if (cit->vectorFormat())
2676 flags.push_back("vector");
2677 if (cit->zippedNative())
2678 flags.push_back("zipped=native");
2679 if (cit->inExportMenu())
2680 flags.push_back("menu=export");
2682 os << getStringFromVector(flags);
2683 os << "\" \"" << cit->mime() << "\"\n";
2687 // Look for deleted formats
2688 for (Formats::const_iterator cit = theSystemFormats().begin();
2689 cit != theSystemFormats().end(); ++cit)
2690 if (!theFormats().getFormat(cit->name()))
2691 os << "\\format \"" << cit->name()
2692 << "\" \"\" \"\" \"\" \"\" \"\" \"\" \"\"\n";
2696 case RC_VIEWER_ALTERNATIVES: {
2697 Alternatives::const_iterator it = viewer_alternatives.begin();
2698 Alternatives::const_iterator const en = viewer_alternatives.end();
2699 Alternatives::const_iterator const sysend =
2700 system_lyxrc.viewer_alternatives.end();
2701 for (; it != en; ++it) {
2702 string const & fmt = it->first;
2703 CommandSet const & cmd = it->second;
2704 CommandSet::const_iterator sit = cmd.begin();
2705 CommandSet::const_iterator const sen = cmd.end();
2706 Alternatives::const_iterator const sysfmt = ignore_system_lyxrc ?
2707 system_lyxrc.viewer_alternatives.begin() : // we won't use it in this case
2708 system_lyxrc.viewer_alternatives.find(fmt);
2709 for (; sit != sen; ++sit) {
2710 string const & cmd = *sit;
2711 if (ignore_system_lyxrc
2712 || sysfmt == sysend // format not found
2713 || sysfmt->second.count(cmd) == 0 // this command not found
2715 os << "\\viewer_alternatives " << fmt << " \"" << escapeCommand(cmd) << "\"\n";
2722 case RC_EDITOR_ALTERNATIVES: {
2723 Alternatives::const_iterator it = editor_alternatives.begin();
2724 Alternatives::const_iterator const en = editor_alternatives.end();
2725 Alternatives::const_iterator const sysend =
2726 system_lyxrc.editor_alternatives.end();
2727 for (; it != en; ++it) {
2728 string const & fmt = it->first;
2729 CommandSet const & cmd = it->second;
2730 CommandSet::const_iterator sit = cmd.begin();
2731 CommandSet::const_iterator const sen = cmd.end();
2732 Alternatives::const_iterator const sysfmt = ignore_system_lyxrc ?
2733 system_lyxrc.editor_alternatives.begin() : // we won't use it in this case
2734 system_lyxrc.editor_alternatives.find(fmt);
2735 for (; sit != sen; ++sit) {
2736 string const & cmd = *sit;
2737 if (ignore_system_lyxrc
2738 || sysfmt == sysend // format not found
2739 || sysfmt->second.count(cmd) == 0 // this command not found
2741 os << "\\editor_alternatives " << fmt << " \"" << escapeCommand(cmd) << "\"\n";
2748 case RC_DEFAULT_OTF_VIEW_FORMAT:
2749 if ((ignore_system_lyxrc ||
2750 default_otf_view_format != system_lyxrc.default_otf_view_format)
2751 && !default_otf_view_format.empty()) {
2752 os << "\\default_otf_view_format " << default_otf_view_format << '\n';
2757 case RC_DEFAULT_PLATEX_VIEW_FORMAT:
2758 if ((ignore_system_lyxrc ||
2759 default_platex_view_format != system_lyxrc.default_platex_view_format)
2760 && !default_platex_view_format.empty()) {
2761 os << "\\default_platex_view_format " << default_platex_view_format << '\n';
2766 case RC_DEFAULT_VIEW_FORMAT:
2767 if (ignore_system_lyxrc ||
2768 default_view_format != system_lyxrc.default_view_format) {
2769 os << "\\default_view_format " << default_view_format << '\n';
2780 << "# CONVERTERS SECTION ##########################\n"
2785 // Look for new converters
2786 for (Converters::const_iterator cit = theConverters().begin();
2787 cit != theConverters().end(); ++cit) {
2788 Converter const * converter =
2789 theSystemConverters().getConverter(cit->from(),
2792 converter->command() != cit->command() ||
2793 converter->flags() != cit->flags())
2794 os << "\\converter \"" << cit->from() << "\" \""
2795 << cit->to() << "\" \""
2796 << escapeCommand(cit->command()) << "\" \""
2797 << cit->flags() << "\"\n";
2800 // New/modifed converters
2801 for (Converters::const_iterator cit = theSystemConverters().begin();
2802 cit != theSystemConverters().end(); ++cit)
2803 if (!theConverters().getConverter(cit->from(), cit->to()))
2804 os << "\\converter \"" << cit->from()
2805 << "\" \"" << cit->to() << "\" \"\" \"\"\n";
2812 << "# COPIERS SECTION ##########################\n"
2815 // Look for new movers
2816 Movers::const_iterator const sysbegin = theSystemMovers().begin();
2817 Movers::const_iterator const sysend = theSystemMovers().end();
2818 Movers::const_iterator it = theMovers().begin();
2819 Movers::const_iterator end = theMovers().end();
2821 for (; it != end; ++it) {
2822 Movers::const_iterator const sysit =
2823 find_if(sysbegin, sysend, SameMover(*it));
2824 if (sysit == sysend) {
2825 string const & fmt = it->first;
2826 string const & command =
2827 it->second.command();
2829 os << "\\copier " << fmt
2830 << " \"" << escapeCommand(command) << "\"\n";
2836 // We don't actually delete SpecialisedMover(s) from the
2837 // map, just clear their 'command', so there's no need
2838 // to test for anything else.
2845 void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new)
2847 // Why the switch you might ask. It is a trick to ensure that all
2848 // the elements in the LyXRCTags enum is handled. As you can see
2849 // there are no breaks at all. So it is just a huge fall-through.
2850 // The nice thing is that we will get a warning from the compiler
2851 // if we forget an element.
2852 LyXRC::LyXRCTags tag = LyXRC::RC_LAST;
2854 case LyXRC::RC_LAST:
2855 case LyXRC::RC_ACCEPT_COMPOUND:
2856 if (lyxrc_orig.spellchecker_accept_compound != lyxrc_new.spellchecker_accept_compound)
2857 if (theSpellChecker()) theSpellChecker()->advanceChangeNumber();
2859 case LyXRC::RC_ALT_LANG:
2860 case LyXRC::RC_PLAINTEXT_LINELEN:
2861 case LyXRC::RC_AUTOCORRECTION_MATH:
2862 case LyXRC::RC_AUTOREGIONDELETE:
2863 case LyXRC::RC_AUTORESET_OPTIONS:
2864 case LyXRC::RC_AUTOSAVE:
2865 case LyXRC::RC_AUTO_NUMBER:
2866 case LyXRC::RC_BACKUPDIR_PATH:
2867 case LyXRC::RC_BIBTEX_ALTERNATIVES:
2868 case LyXRC::RC_BIBTEX_COMMAND:
2869 case LyXRC::RC_BINDFILE:
2870 case LyXRC::RC_CHECKLASTFILES:
2871 case LyXRC::RC_COMPLETION_CURSOR_TEXT:
2872 case LyXRC::RC_COMPLETION_INLINE_DELAY:
2873 case LyXRC::RC_COMPLETION_INLINE_DOTS:
2874 case LyXRC::RC_COMPLETION_INLINE_MATH:
2875 case LyXRC::RC_COMPLETION_INLINE_TEXT:
2876 case LyXRC::RC_COMPLETION_POPUP_AFTER_COMPLETE:
2877 case LyXRC::RC_COMPLETION_POPUP_DELAY:
2878 case LyXRC::RC_COMPLETION_POPUP_MATH:
2879 case LyXRC::RC_COMPLETION_POPUP_TEXT:
2880 case LyXRC::RC_COMPLETION_MINLENGTH:
2881 case LyXRC::RC_USELASTFILEPOS:
2882 case LyXRC::RC_LOADSESSION:
2883 case LyXRC::RC_CHKTEX_COMMAND:
2884 case LyXRC::RC_CONVERTER:
2885 case LyXRC::RC_CONVERTER_CACHE_MAXAGE:
2886 case LyXRC::RC_COPIER:
2887 case LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR:
2888 case LyXRC::RC_SCROLL_BELOW_DOCUMENT:
2889 case LyXRC::RC_GUI_LANGUAGE:
2890 case LyXRC::RC_DEFAULT_OTF_VIEW_FORMAT:
2891 case LyXRC::RC_DEFAULT_PLATEX_VIEW_FORMAT:
2892 case LyXRC::RC_DEFAULT_VIEW_FORMAT:
2893 case LyXRC::RC_DEFFILE:
2894 case LyXRC::RC_DIALOGS_ICONIFY_WITH_MAIN:
2895 case LyXRC::RC_DISPLAY_GRAPHICS:
2896 case LyXRC::RC_DOCUMENTPATH:
2897 if (lyxrc_orig.document_path != lyxrc_new.document_path) {
2898 FileName path(lyxrc_new.document_path);
2899 if (path.exists() && path.isDirectory())
2900 package().document_dir() = FileName(lyxrc.document_path);
2903 case LyXRC::RC_EDITOR_ALTERNATIVES:
2904 case LyXRC::RC_ESC_CHARS:
2905 case LyXRC::RC_EXAMPLEPATH:
2906 case LyXRC::RC_FILEFORMAT:
2907 case LyXRC::RC_GROUP_LAYOUTS:
2908 case LyXRC::RC_HUNSPELLDIR_PATH:
2909 case LyXRC::RC_ICON_SET:
2910 case LyXRC::RC_INDEX_ALTERNATIVES:
2911 case LyXRC::RC_INDEX_COMMAND:
2912 case LyXRC::RC_JBIBTEX_COMMAND:
2913 case LyXRC::RC_JBIBTEX_ALTERNATIVES:
2914 case LyXRC::RC_JINDEX_COMMAND:
2915 case LyXRC::RC_NOMENCL_COMMAND:
2916 case LyXRC::RC_PYGMENTIZE_COMMAND:
2917 case LyXRC::RC_INPUT:
2918 case LyXRC::RC_KBMAP:
2919 case LyXRC::RC_KBMAP_PRIMARY:
2920 case LyXRC::RC_KBMAP_SECONDARY:
2921 case LyXRC::RC_LANGUAGE_AUTO_BEGIN:
2922 case LyXRC::RC_LANGUAGE_AUTO_END:
2923 case LyXRC::RC_LANGUAGE_COMMAND_BEGIN:
2924 case LyXRC::RC_LANGUAGE_COMMAND_END:
2925 case LyXRC::RC_LANGUAGE_COMMAND_LOCAL:
2926 case LyXRC::RC_LANGUAGE_GLOBAL_OPTIONS:
2927 case LyXRC::RC_LANGUAGE_CUSTOM_PACKAGE:
2928 case LyXRC::RC_LANGUAGE_PACKAGE_SELECTION:
2929 case LyXRC::RC_LYXRCFORMAT:
2930 case LyXRC::RC_MAC_DONTSWAP_CTRL_META:
2931 case LyXRC::RC_MAC_LIKE_CURSOR_MOVEMENT:
2932 case LyXRC::RC_MACRO_EDIT_STYLE:
2933 case LyXRC::RC_MAKE_BACKUP:
2934 case LyXRC::RC_MARK_FOREIGN_LANGUAGE:
2935 case LyXRC::RC_MOUSE_WHEEL_SPEED:
2936 case LyXRC::RC_MOUSE_MIDDLEBUTTON_PASTE:
2937 case LyXRC::RC_NUMLASTFILES:
2938 case LyXRC::RC_PARAGRAPH_MARKERS:
2939 case LyXRC::RC_PATH_PREFIX:
2940 if (lyxrc_orig.path_prefix != lyxrc_new.path_prefix) {
2941 prependEnvPath("PATH", replaceEnvironmentPath(lyxrc_new.path_prefix));
2942 // Resets python path
2943 support::os::python(true);
2946 case LyXRC::RC_PREVIEW:
2947 if (lyxrc_orig.preview != lyxrc_new.preview) {
2948 // Update all previews of all documents.
2949 /* FIXME: this can be very expensive. It would be cheaper
2950 * to kill all existing previews and update visible
2952 theBufferList().updatePreviews();
2955 case LyXRC::RC_PREVIEW_HASHED_LABELS:
2956 case LyXRC::RC_PREVIEW_SCALE_FACTOR:
2957 case LyXRC::RC_PRINTLANDSCAPEFLAG:
2958 case LyXRC::RC_PRINTPAPERDIMENSIONFLAG:
2959 case LyXRC::RC_PRINTPAPERFLAG:
2960 case LyXRC::RC_SAVE_COMPRESSED:
2961 case LyXRC::RC_SAVE_ORIGIN:
2962 case LyXRC::RC_SCREEN_DPI:
2964 case LyXRC::RC_SCREEN_FONT_ROMAN:
2965 case LyXRC::RC_SCREEN_FONT_ROMAN_FOUNDRY:
2966 case LyXRC::RC_SCREEN_FONT_SANS:
2967 case LyXRC::RC_SCREEN_FONT_SANS_FOUNDRY:
2968 case LyXRC::RC_SCREEN_FONT_SCALABLE:
2969 case LyXRC::RC_SCREEN_FONT_SIZES:
2970 case LyXRC::RC_SCREEN_FONT_TYPEWRITER:
2971 case LyXRC::RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
2972 case LyXRC::RC_SCREEN_ZOOM:
2973 if (lyxrc_orig.roman_font_name != lyxrc_new.roman_font_name
2974 || lyxrc_orig.sans_font_name != lyxrc_new.sans_font_name
2975 || lyxrc_orig.typewriter_font_name != lyxrc_new.typewriter_font_name
2976 || lyxrc_orig.roman_font_foundry != lyxrc_new.roman_font_foundry
2977 || lyxrc_orig.sans_font_foundry != lyxrc_new.sans_font_foundry
2978 || lyxrc_orig.use_scalable_fonts != lyxrc_new.use_scalable_fonts
2979 || lyxrc_orig.font_sizes != lyxrc_new.font_sizes
2980 || lyxrc_orig.typewriter_font_foundry != lyxrc_new.typewriter_font_foundry
2981 || lyxrc_orig.defaultZoom != lyxrc_new.defaultZoom) {
2982 dispatch(FuncRequest(LFUN_SCREEN_FONT_UPDATE));
2985 case LyXRC::RC_GEOMETRY_SESSION:
2986 case LyXRC::RC_SERVERPIPE:
2987 case LyXRC::RC_SET_COLOR:
2988 case LyXRC::RC_SHOW_BANNER:
2989 case LyXRC::RC_OPEN_BUFFERS_IN_TABS:
2990 case LyXRC::RC_SPELLCHECKER:
2991 if (lyxrc_orig.spellchecker != lyxrc_new.spellchecker)
2994 case LyXRC::RC_SPELLCHECK_CONTINUOUSLY:
2995 case LyXRC::RC_SPELLCHECK_NOTES:
2996 case LyXRC::RC_SPLITINDEX_COMMAND:
2997 case LyXRC::RC_TEMPDIRPATH:
2998 case LyXRC::RC_TEMPLATEPATH:
2999 case LyXRC::RC_TEX_ALLOWS_SPACES:
3000 case LyXRC::RC_TEX_EXPECTS_WINDOWS_PATHS:
3001 if (lyxrc_orig.windows_style_tex_paths != lyxrc_new.windows_style_tex_paths) {
3002 os::windows_style_tex_paths(lyxrc_new.windows_style_tex_paths);
3005 case LyXRC::RC_TEXINPUTS_PREFIX:
3006 case LyXRC::RC_THESAURUSDIRPATH:
3007 case LyXRC::RC_UIFILE:
3008 case LyXRC::RC_USER_EMAIL:
3009 case LyXRC::RC_USER_NAME:
3010 case LyXRC::RC_USE_CONVERTER_CACHE:
3011 case LyXRC::RC_USE_CONVERTER_NEEDAUTH_FORBIDDEN:
3012 case LyXRC::RC_USE_CONVERTER_NEEDAUTH:
3013 case LyXRC::RC_USE_NATIVE_FILEDIALOG:
3014 case LyXRC::RC_USE_SYSTEM_COLORS:
3015 case LyXRC::RC_USE_TOOLTIP:
3016 case LyXRC::RC_USE_SYSTEM_THEME_ICONS:
3017 case LyXRC::RC_VIEWDVI_PAPEROPTION:
3018 case LyXRC::RC_SINGLE_CLOSE_TAB_BUTTON:
3019 case LyXRC::RC_SINGLE_INSTANCE:
3020 case LyXRC::RC_SORT_LAYOUTS:
3021 case LyXRC::RC_FULL_SCREEN_LIMIT:
3022 case LyXRC::RC_FULL_SCREEN_SCROLLBAR:
3023 case LyXRC::RC_FULL_SCREEN_MENUBAR:
3024 case LyXRC::RC_FULL_SCREEN_STATUSBAR:
3025 case LyXRC::RC_FULL_SCREEN_TABBAR:
3026 case LyXRC::RC_FULL_SCREEN_TOOLBARS:
3027 case LyXRC::RC_FULL_SCREEN_WIDTH:
3028 case LyXRC::RC_VISUAL_CURSOR:
3029 case LyXRC::RC_CLOSE_BUFFER_WITH_LAST_VIEW:
3030 case LyXRC::RC_VIEWER:
3031 case LyXRC::RC_VIEWER_ALTERNATIVES:
3032 case LyXRC::RC_FORWARD_SEARCH_DVI:
3033 case LyXRC::RC_FORWARD_SEARCH_PDF:
3034 case LyXRC::RC_EXPORT_OVERWRITE:
3035 case LyXRC::RC_DEFAULT_DECIMAL_POINT:
3036 case LyXRC::RC_DEFAULT_LENGTH_UNIT:
3037 case LyXRC::RC_SCROLL_WHEEL_ZOOM:
3038 case LyXRC::RC_CURSOR_WIDTH:
3044 set<string> LyXRC::getRCs()
3047 for (int i = 0; i != lyxrcCount; ++i)
3048 res.insert(ltrim(lyxrcTags[i].tag, "\\"));
3054 string const LyXRC::getDescription(LyXRCTags tag)
3059 case RC_ACCEPT_COMPOUND:
3060 str = _("Consider run-together words, such as \"diskdrive\" for \"disk drive\", as legal words?");
3064 str = _("Specify an alternate language. The default is to use the language of the document.");
3067 case RC_PLAINTEXT_LINELEN:
3068 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.");
3071 case RC_AUTOREGIONDELETE:
3072 str = _("De-select if you don't want the current selection to be replaced automatically by what you type.");
3075 case RC_AUTORESET_OPTIONS:
3076 str = _("De-select if you don't want the class options to be reset to defaults after class change.");
3080 str = _("The time interval between auto-saves (in seconds). 0 means no auto-save.");
3083 case RC_AUTO_NUMBER:
3086 case RC_BACKUPDIR_PATH:
3087 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.");
3090 case RC_BIBTEX_COMMAND:
3091 str = _("Define the options of bibtex (cf. man bibtex) or select an alternative compiler (e.g. mlbibtex or bibulus).");
3094 case RC_JBIBTEX_COMMAND:
3095 str = _("Define the options of the bibtex program for PLaTeX (Japanese LaTeX).");
3099 str = _("Keybindings file. Can either specify an absolute path, or LyX will look in its global and local bind/ directories.");
3102 case RC_CHECKLASTFILES:
3103 str = _("Select to check whether the lastfiles still exist.");
3106 case RC_CHKTEX_COMMAND:
3107 str = _("Define how to run chktex. E.g. \"chktex -n11 -n1 -n3 -n6 -n9 -22 -n25 -n30 -n38\" Refer to the ChkTeX documentation.");
3113 case RC_CONVERTER_NEEDAUTH_FORBIDDEN:
3114 str = _("Forbid use of external converters with 'needauth' option to prevent undesired effects.");
3117 case RC_CONVERTER_NEEDAUTH:
3118 str = _("Ask user before calling external converters with 'needauth' option to prevent undesired effects.");
3124 case RC_CURSOR_FOLLOWS_SCROLLBAR:
3125 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.");
3128 case RC_CURSOR_WIDTH:
3129 str = _("Configure the width of the text cursor. Automatic zoom-controlled cursor width used when set to 0.");
3132 case RC_SCROLL_BELOW_DOCUMENT:
3133 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");
3136 case RC_MAC_DONTSWAP_CTRL_META:
3137 str = _("Make Apple key act as Meta and Control key as Ctrl.");
3140 case RC_MAC_LIKE_CURSOR_MOVEMENT:
3141 str = _("Use the Mac OS X conventions for cursor movement");
3144 case RC_SHOW_MACRO_LABEL:
3145 str = _("Show a small box around a Math Macro with the macro name when the cursor is inside.");
3149 str = _("Command definition file. Can either specify an absolute path, or LyX will look in its global and local commands/ directories.");
3152 case RC_DEFAULT_OTF_VIEW_FORMAT:
3153 str = _("The default format used with LFUN_BUFFER_[VIEW|UPDATE] with non-TeX fonts.");
3156 case RC_DEFAULT_VIEW_FORMAT:
3157 str = _("The default format used with LFUN_BUFFER_[VIEW|UPDATE].");
3160 case RC_DIALOGS_ICONIFY_WITH_MAIN:
3161 str = _("Iconify the dialogs when the main window is iconified. (Affects only dialogs shown after the change has been made.)");
3164 case RC_DISPLAY_GRAPHICS:
3165 str = _("Select how LyX will display any graphics.");
3168 case RC_DOCUMENTPATH:
3169 str = _("The default path for your documents. An empty value selects the directory LyX was started from.");
3173 str = _("Specify additional chars that can be part of a word.");
3176 case RC_EXAMPLEPATH:
3177 str = _("The path that LyX will set when offering to choose an example. An empty value selects the directory LyX was started from.");
3183 case RC_INDEX_COMMAND:
3184 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\".");
3187 case RC_JINDEX_COMMAND:
3188 str = _("Define the options of the index program for PLaTeX (Japanese LaTeX).");
3191 case RC_NOMENCL_COMMAND:
3192 str = _("Define the options of makeindex (cf. man makeindex) to be used for nomenclatures. This might differ from the index processing options.");
3195 case RC_PYGMENTIZE_COMMAND:
3196 str = _("The command to run the python pygments syntax highlighter.");
3203 case RC_KBMAP_PRIMARY:
3204 case RC_KBMAP_SECONDARY:
3205 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.");
3208 case RC_LANGUAGE_AUTO_BEGIN:
3209 str = _("Select if a language switching command is needed at the beginning of the document.");
3212 case RC_LANGUAGE_AUTO_END:
3213 str = _("Select if a language switching command is needed at the end of the document.");
3216 case RC_LANGUAGE_COMMAND_BEGIN:
3217 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.");
3220 case RC_LANGUAGE_COMMAND_END:
3221 str = _("The LaTeX command for changing back to the language of the document.");
3224 case RC_LANGUAGE_COMMAND_LOCAL:
3225 str = _("The LaTeX command for local changing of the language.");
3228 case RC_LANGUAGE_GLOBAL_OPTIONS:
3229 str = _("De-select if you don't want the language(s) used as an argument to \\documentclass.");
3232 case RC_LANGUAGE_CUSTOM_PACKAGE:
3233 str = _("The LaTeX command for loading the language package. E.g. \"\\usepackage{babel}\", \"\\usepackage{omega}\".");
3236 case RC_LANGUAGE_PACKAGE_SELECTION:
3237 str = _("De-select if you don't want babel to be used when the language of the document is the default language.");
3240 case RC_USELASTFILEPOS:
3241 str = _("De-select if you do not want LyX to scroll to saved position.");
3244 case RC_LOADSESSION:
3245 str = _("De-select to prevent loading files opened from the last LyX session.");
3248 case RC_MAKE_BACKUP:
3249 str = _("De-select if you don't want LyX to create backup files.");
3252 case RC_MARK_FOREIGN_LANGUAGE:
3253 str = _("Select to control the highlighting of words with a language foreign to that of the document.");
3256 case RC_MOUSE_WHEEL_SPEED:
3257 str = _("The scrolling speed of the mouse wheel.");
3260 case RC_COMPLETION_POPUP_DELAY:
3261 str = _("The completion popup delay.");
3264 case RC_COMPLETION_POPUP_MATH:
3265 str = _("Select to display the completion popup in math mode.");
3268 case RC_COMPLETION_POPUP_TEXT:
3269 str = _("Select to display the completion popup in text mode.");
3272 case RC_COMPLETION_POPUP_AFTER_COMPLETE:
3273 str = _("Show the completion popup without delay after non-unique completion attempt.");
3276 case RC_COMPLETION_POPUP_TEXT:
3277 str = _("Show a small triangle on the cursor to indicate that a completion is available.");
3280 case RC_COMPLETION_POPUP_DELAY:
3281 str = _("The inline completion delay.");
3284 case RC_COMPLETION_INLINE_MATH:
3285 str = _("Select to display the inline completion in math mode.");
3288 case RC_COMPLETION_INLINE_TEXT:
3289 str = _("Select to display the inline completion in text mode.");
3292 case RC_COMPLETION_INLINE_DOTS:
3293 str = _("Use \"...\" to shorten long completions.");
3296 case RC_AUTOCORRECTION_MATH:
3297 str = _("Allow TeXMacs shorthand, like => converting to \\Rightarrow.");
3300 case RC_NUMLASTFILES:
3301 str = bformat(_("Maximal number of lastfiles. Up to %1$d can appear in the file menu."),
3305 case RC_PATH_PREFIX:
3306 str = _("Specify those directories which should be "
3307 "prepended to the PATH environment variable.\n"
3308 "Use the OS native format.");
3312 str = _("Shows a typeset preview of things such as math");
3315 case RC_PREVIEW_HASHED_LABELS:
3316 str = _("Previewed equations will have \"(#)\" labels rather than numbered ones");
3319 case RC_PREVIEW_SCALE_FACTOR:
3320 str = _("Scale the preview size to suit.");
3323 case RC_PRINTLANDSCAPEFLAG:
3324 str = _("The option to print out in landscape.");
3327 case RC_PRINTPAPERDIMENSIONFLAG:
3328 str = _("Option to specify the dimensions of the print paper.");
3331 case RC_PRINTPAPERFLAG:
3332 str = _("The option to specify paper type.");
3335 case RC_VISUAL_CURSOR:
3336 str = _("Select to have visual bidi cursor movement, unselect for logical movement.");
3339 case RC_CLOSE_BUFFER_WITH_LAST_VIEW:
3340 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).");
3344 str = _("DPI (dots per inch) of your monitor is auto-detected by LyX. If that goes wrong, override the setting here.");
3347 case RC_SCREEN_FONT_ROMAN:
3348 case RC_SCREEN_FONT_SANS:
3349 case RC_SCREEN_FONT_TYPEWRITER:
3350 str = _("The screen fonts used to display the text while editing.");
3353 case RC_SCREEN_FONT_ROMAN_FOUNDRY:
3354 case RC_SCREEN_FONT_SANS_FOUNDRY:
3355 case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
3358 case RC_SCREEN_FONT_SCALABLE:
3359 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.");
3362 case RC_SCREEN_FONT_SIZES:
3363 str = _("The font sizes used for calculating the scaling of the screen fonts.");
3366 case RC_SCREEN_ZOOM:
3367 //xgettext:no-c-format
3368 str = _("The zoom percentage for screen fonts. A setting of 100% will make the fonts roughly the same size as on paper.");
3371 case RC_GEOMETRY_SESSION:
3372 str = _("Allow session manager to save and restore windows geometry.");
3376 str = _("This starts the lyxserver. The pipes get an additional extension \".in\" and \".out\". Only for advanced users.");
3382 case RC_SHOW_BANNER:
3383 str = _("De-select if you don't want the startup banner.");
3386 case RC_TEMPDIRPATH:
3387 str = _("LyX will place its temporary directories in this path. They will be deleted when you quit LyX.");
3390 case RC_THESAURUSDIRPATH:
3391 str = _("This is the place where the files of the thesaurus library reside.");
3394 case RC_TEMPLATEPATH:
3395 str = _("The path that LyX will set when offering to choose a template. An empty value selects the directory LyX was started from.");
3398 case RC_TEX_ALLOWS_SPACES:
3401 case RC_TEX_EXPECTS_WINDOWS_PATHS:
3404 case RC_TEXINPUTS_PREFIX:
3405 str = _("Specify those directories which should be "
3406 "prepended to the TEXINPUTS environment variable.\n"
3407 "A '.' represents the current document directory. "
3408 "Use the OS native format.");
3412 str = _("The UI (user interface) file. Can either specify an absolute path, or LyX will look in its global and local ui/ directories.");
3421 case RC_USE_USE_SYSTEM_COLORS:
3422 str = _("Enable use the system colors for some things like main window background and selection.");
3425 case RC_USE_TOOLTIP:
3426 str = _("Enable the automatic appearance of tool tips in the work area.");
3429 case RC_VIEWDVI_PAPEROPTION:
3430 _("Specify the paper command to DVI viewer (leave empty or use \"-paper\")");
3445 // The global instance
3448 // The global copy of the system lyxrc entries (everything except preferences)