3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
6 * \author Lars Gullik Bjønnes
7 * \author Jean-Marc Lasgouttes
8 * \author Angus Leeming
10 * \author André Pönitz
14 * Full author contact details are available in file CREDITS.
21 #include "BufferList.h"
23 #include "Converter.h"
24 #include "FontEnums.h"
30 #include "SpellChecker.h"
33 #include "graphics/GraphicsTypes.h"
35 #include "support/convert.h"
36 #include "support/debug.h"
37 #include "support/environment.h"
38 #include "support/FileName.h"
39 #include "support/filetools.h"
40 #include "support/gettext.h"
41 #include "support/lstrings.h"
42 #include "support/os.h"
43 #include "support/Package.h"
44 #include "support/TempFile.h"
45 #include "support/userinfo.h"
52 using namespace lyx::support;
56 namespace os = support::os;
60 // The format should also be updated in configure.py, and conversion code
61 // should be added to prefs2prefs_prefs.py.
62 static unsigned int const LYXRC_FILEFORMAT = 28; // spitz: remove \\date_insert_format
63 // when adding something to this array keep it sorted!
64 LexerKeyword lyxrcTags[] = {
65 { "\\accept_compound", LyXRC::RC_ACCEPT_COMPOUND },
66 { "\\allow_geometry_session", LyXRC::RC_GEOMETRY_SESSION },
67 { "\\alternate_language", LyXRC::RC_ALT_LANG },
68 { "\\auto_number", LyXRC::RC_AUTO_NUMBER },
69 { "\\auto_region_delete", LyXRC::RC_AUTOREGIONDELETE },
70 { "\\auto_reset_options", LyXRC::RC_AUTORESET_OPTIONS },
71 { "\\autocorrection_math", LyXRC::RC_AUTOCORRECTION_MATH },
72 { "\\autosave", LyXRC::RC_AUTOSAVE },
73 { "\\backupdir_path", LyXRC::RC_BACKUPDIR_PATH },
74 { "\\bibtex_alternatives", LyXRC::RC_BIBTEX_ALTERNATIVES },
75 { "\\bibtex_command", LyXRC::RC_BIBTEX_COMMAND },
76 { "\\bind_file", LyXRC::RC_BINDFILE },
77 { "\\check_lastfiles", LyXRC::RC_CHECKLASTFILES },
78 { "\\chktex_command", LyXRC::RC_CHKTEX_COMMAND },
79 { "\\close_buffer_with_last_view", LyXRC::RC_CLOSE_BUFFER_WITH_LAST_VIEW },
80 { "\\completion_cursor_text", LyXRC::RC_COMPLETION_CURSOR_TEXT },
81 { "\\completion_inline_delay", LyXRC::RC_COMPLETION_INLINE_DELAY },
82 { "\\completion_inline_dots", LyXRC::RC_COMPLETION_INLINE_DOTS },
83 { "\\completion_inline_math", LyXRC::RC_COMPLETION_INLINE_MATH },
84 { "\\completion_inline_text", LyXRC::RC_COMPLETION_INLINE_TEXT },
85 { "\\completion_minlength", LyXRC::RC_COMPLETION_MINLENGTH },
86 { "\\completion_popup_after_complete", LyXRC::RC_COMPLETION_POPUP_AFTER_COMPLETE },
87 { "\\completion_popup_delay", LyXRC::RC_COMPLETION_POPUP_DELAY },
88 { "\\completion_popup_math", LyXRC::RC_COMPLETION_POPUP_MATH },
89 { "\\completion_popup_text", LyXRC::RC_COMPLETION_POPUP_TEXT },
90 { "\\converter", LyXRC::RC_CONVERTER },
91 { "\\converter_cache_maxage", LyXRC::RC_CONVERTER_CACHE_MAXAGE },
92 { "\\copier", LyXRC::RC_COPIER },
93 { "\\cursor_follows_scrollbar", LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR },
94 { "\\cursor_width", LyXRC::RC_CURSOR_WIDTH },
95 { "\\def_file", LyXRC::RC_DEFFILE },
96 { "\\default_decimal_point", LyXRC::RC_DEFAULT_DECIMAL_POINT },
97 { "\\default_length_unit", LyXRC::RC_DEFAULT_LENGTH_UNIT },
98 { "\\default_otf_view_format", LyXRC::RC_DEFAULT_OTF_VIEW_FORMAT },
99 { "\\default_platex_view_format", LyXRC::RC_DEFAULT_PLATEX_VIEW_FORMAT },
100 { "\\default_view_format", LyXRC::RC_DEFAULT_VIEW_FORMAT },
101 { "\\dialogs_iconify_with_main", LyXRC::RC_DIALOGS_ICONIFY_WITH_MAIN },
102 { "\\display_graphics", LyXRC::RC_DISPLAY_GRAPHICS },
103 { "\\document_path", LyXRC::RC_DOCUMENTPATH },
104 { "\\editor_alternatives", LyXRC::RC_EDITOR_ALTERNATIVES },
105 { "\\escape_chars", LyXRC::RC_ESC_CHARS },
106 { "\\example_path", LyXRC::RC_EXAMPLEPATH },
107 { "\\export_overwrite", LyXRC::RC_EXPORT_OVERWRITE },
108 { "\\format", LyXRC::RC_FILEFORMAT },
109 { "\\forward_search_dvi", LyXRC::RC_FORWARD_SEARCH_DVI },
110 { "\\forward_search_pdf", LyXRC::RC_FORWARD_SEARCH_PDF },
111 { "\\fullscreen_limit", LyXRC::RC_FULL_SCREEN_LIMIT },
112 { "\\fullscreen_menubar", LyXRC::RC_FULL_SCREEN_MENUBAR },
113 { "\\fullscreen_scrollbar", LyXRC::RC_FULL_SCREEN_SCROLLBAR },
114 { "\\fullscreen_statusbar", LyXRC::RC_FULL_SCREEN_STATUSBAR },
115 { "\\fullscreen_tabbar", LyXRC::RC_FULL_SCREEN_TABBAR },
116 { "\\fullscreen_toolbars", LyXRC::RC_FULL_SCREEN_TOOLBARS },
117 { "\\fullscreen_width", LyXRC::RC_FULL_SCREEN_WIDTH },
118 { "\\group_layouts", LyXRC::RC_GROUP_LAYOUTS },
119 { "\\gui_language", LyXRC::RC_GUI_LANGUAGE },
120 { "\\hunspelldir_path", LyXRC::RC_HUNSPELLDIR_PATH },
121 { "\\icon_set", LyXRC::RC_ICON_SET },
122 { "\\index_alternatives", LyXRC::RC_INDEX_ALTERNATIVES },
123 { "\\index_command", LyXRC::RC_INDEX_COMMAND },
124 { "\\input", LyXRC::RC_INPUT },
125 { "\\jbibtex_alternatives", LyXRC::RC_JBIBTEX_ALTERNATIVES },
126 { "\\jbibtex_command", LyXRC::RC_JBIBTEX_COMMAND },
127 { "\\jindex_command", LyXRC::RC_JINDEX_COMMAND },
128 { "\\kbmap", LyXRC::RC_KBMAP },
129 { "\\kbmap_primary", LyXRC::RC_KBMAP_PRIMARY },
130 { "\\kbmap_secondary", LyXRC::RC_KBMAP_SECONDARY },
131 { "\\language_auto_begin", LyXRC::RC_LANGUAGE_AUTO_BEGIN },
132 { "\\language_auto_end", LyXRC::RC_LANGUAGE_AUTO_END },
133 { "\\language_command_begin", LyXRC::RC_LANGUAGE_COMMAND_BEGIN },
134 { "\\language_command_end", LyXRC::RC_LANGUAGE_COMMAND_END },
135 { "\\language_command_local", LyXRC::RC_LANGUAGE_COMMAND_LOCAL },
136 { "\\language_custom_package", LyXRC::RC_LANGUAGE_CUSTOM_PACKAGE },
137 { "\\language_global_options", LyXRC::RC_LANGUAGE_GLOBAL_OPTIONS },
138 { "\\language_package_selection", LyXRC::RC_LANGUAGE_PACKAGE_SELECTION },
139 { "\\load_session", LyXRC::RC_LOADSESSION },
140 { "\\mac_dontswap_ctrl_meta", LyXRC::RC_MAC_DONTSWAP_CTRL_META },
141 { "\\mac_like_cursor_movement", LyXRC::RC_MAC_LIKE_CURSOR_MOVEMENT },
142 { "\\macro_edit_style", LyXRC::RC_MACRO_EDIT_STYLE },
143 { "\\make_backup", LyXRC::RC_MAKE_BACKUP },
144 { "\\mark_foreign_language", LyXRC::RC_MARK_FOREIGN_LANGUAGE },
145 { "\\mouse_middlebutton_paste", LyXRC::RC_MOUSE_MIDDLEBUTTON_PASTE },
146 { "\\mouse_wheel_speed", LyXRC::RC_MOUSE_WHEEL_SPEED },
147 { "\\nomencl_command", LyXRC::RC_NOMENCL_COMMAND },
148 { "\\num_lastfiles", LyXRC::RC_NUMLASTFILES },
149 { "\\open_buffers_in_tabs", LyXRC::RC_OPEN_BUFFERS_IN_TABS },
150 { "\\paragraph_markers", LyXRC::RC_PARAGRAPH_MARKERS },
151 { "\\path_prefix", LyXRC::RC_PATH_PREFIX },
152 { "\\plaintext_linelen", LyXRC::RC_PLAINTEXT_LINELEN },
153 { "\\preview", LyXRC::RC_PREVIEW },
154 { "\\preview_hashed_labels", LyXRC::RC_PREVIEW_HASHED_LABELS },
155 { "\\preview_scale_factor", LyXRC::RC_PREVIEW_SCALE_FACTOR },
156 { "\\print_landscape_flag", LyXRC::RC_PRINTLANDSCAPEFLAG },
157 { "\\print_paper_dimension_flag", LyXRC::RC_PRINTPAPERDIMENSIONFLAG },
158 { "\\print_paper_flag", LyXRC::RC_PRINTPAPERFLAG },
159 { "\\pygmentize_command", LyXRC::RC_PYGMENTIZE_COMMAND },
160 { "\\save_compressed", LyXRC::RC_SAVE_COMPRESSED },
161 { "\\save_origin", LyXRC::RC_SAVE_ORIGIN },
162 { "\\screen_dpi", LyXRC::RC_SCREEN_DPI },
163 { "\\screen_font_roman", LyXRC::RC_SCREEN_FONT_ROMAN },
164 { "\\screen_font_roman_foundry", LyXRC::RC_SCREEN_FONT_ROMAN_FOUNDRY },
165 { "\\screen_font_sans", LyXRC::RC_SCREEN_FONT_SANS },
166 { "\\screen_font_sans_foundry", LyXRC::RC_SCREEN_FONT_SANS_FOUNDRY },
167 { "\\screen_font_scalable", LyXRC::RC_SCREEN_FONT_SCALABLE },
168 { "\\screen_font_sizes", LyXRC::RC_SCREEN_FONT_SIZES },
169 { "\\screen_font_typewriter", LyXRC::RC_SCREEN_FONT_TYPEWRITER },
170 { "\\screen_font_typewriter_foundry", LyXRC::RC_SCREEN_FONT_TYPEWRITER_FOUNDRY },
171 { "\\screen_zoom", LyXRC::RC_SCREEN_ZOOM },
172 { "\\scroll_below_document", LyXRC::RC_SCROLL_BELOW_DOCUMENT },
173 { "\\scroll_wheel_zoom", LyXRC::RC_SCROLL_WHEEL_ZOOM },
174 { "\\serverpipe", LyXRC::RC_SERVERPIPE },
175 { "\\set_color", LyXRC::RC_SET_COLOR },
176 { "\\show_banner", LyXRC::RC_SHOW_BANNER },
177 { "\\single_close_tab_button", LyXRC::RC_SINGLE_CLOSE_TAB_BUTTON },
178 { "\\single_instance", LyXRC::RC_SINGLE_INSTANCE },
179 { "\\sort_layouts", LyXRC::RC_SORT_LAYOUTS },
180 { "\\spellcheck_continuously", LyXRC::RC_SPELLCHECK_CONTINUOUSLY },
181 { "\\spellcheck_notes", LyXRC::RC_SPELLCHECK_NOTES },
182 { "\\spellchecker", LyXRC::RC_SPELLCHECKER },
183 { "\\splitindex_command", LyXRC::RC_SPLITINDEX_COMMAND },
184 { "\\tempdir_path", LyXRC::RC_TEMPDIRPATH },
185 { "\\template_path", LyXRC::RC_TEMPLATEPATH },
186 { "\\tex_allows_spaces", LyXRC::RC_TEX_ALLOWS_SPACES },
187 { "\\tex_expects_windows_paths", LyXRC::RC_TEX_EXPECTS_WINDOWS_PATHS },
188 { "\\texinputs_prefix", LyXRC::RC_TEXINPUTS_PREFIX },
189 { "\\thesaurusdir_path", LyXRC::RC_THESAURUSDIRPATH },
190 { "\\ui_file", LyXRC::RC_UIFILE },
191 { "\\use_converter_cache", LyXRC::RC_USE_CONVERTER_CACHE },
192 { "\\use_converter_needauth", LyXRC::RC_USE_CONVERTER_NEEDAUTH },
193 { "\\use_converter_needauth_forbidden", LyXRC::RC_USE_CONVERTER_NEEDAUTH_FORBIDDEN },
194 { "\\use_lastfilepos", LyXRC::RC_USELASTFILEPOS },
195 { "\\use_native_filedialog", LyXRC::RC_USE_NATIVE_FILEDIALOG },
196 { "\\use_pixmap_cache", LyXRC::RC_USE_PIXMAP_CACHE },
197 // compatibility with versions older than 1.4.0 only
198 { "\\use_system_colors", LyXRC::RC_USE_SYSTEM_COLORS },
199 { "\\use_system_theme_icons", LyXRC::RC_USE_SYSTEM_THEME_ICONS },
200 { "\\use_tooltip", LyXRC::RC_USE_TOOLTIP },
201 { "\\user_email", LyXRC::RC_USER_EMAIL },
202 { "\\user_name", LyXRC::RC_USER_NAME },
203 { "\\view_dvi_paper_option", LyXRC::RC_VIEWDVI_PAPEROPTION },
204 // compatibility with versions older than 1.4.0 only
205 { "\\viewer", LyXRC::RC_VIEWER},
206 { "\\viewer_alternatives", LyXRC::RC_VIEWER_ALTERNATIVES },
207 { "\\visual_cursor", LyXRC::RC_VISUAL_CURSOR },
208 { "format", LyXRC::RC_LYXRCFORMAT }
211 const int lyxrcCount = sizeof(lyxrcTags) / sizeof(lyxrcTags[0]);
222 void LyXRC::setDefaults()
225 use_system_theme_icons = false;
227 def_file = "default";
229 // The current document directory
230 texinputs_prefix = ".";
231 print_landscape_flag = "-t landscape";
232 print_paper_flag = "-t";
233 print_paper_dimension_flag = "-T";
234 document_path.erase();
235 view_dvi_paper_option.erase();
236 default_view_format = "pdf2";
237 default_otf_view_format = "pdf4";
238 default_platex_view_format = "pdf3";
239 chktex_command = "chktex -n1 -n3 -n6 -n9 -n22 -n25 -n30 -n38";
240 bibtex_command = "automatic";
241 index_command = "makeindex -c -q";
242 nomencl_command = "makeindex -s nomencl.ist";
243 pygmentize_command = string();
245 // Because a screen is typically wider than a piece of paper:
247 currentZoom = defaultZoom;
248 allow_geometry_session = true;
249 // Default LaTeX font size:
250 font_sizes[FONT_SIZE_TINY] = "5.0";
251 font_sizes[FONT_SIZE_SCRIPT] = "7.0";
252 font_sizes[FONT_SIZE_FOOTNOTE] = "8.0";
253 font_sizes[FONT_SIZE_SMALL] = "9.0";
254 font_sizes[FONT_SIZE_NORMAL] = "10.0";
255 font_sizes[FONT_SIZE_LARGE] = "12.0";
256 font_sizes[FONT_SIZE_LARGER] = "14.4";
257 font_sizes[FONT_SIZE_LARGEST] = "17.26";
258 font_sizes[FONT_SIZE_HUGE] = "20.74";
259 font_sizes[FONT_SIZE_HUGER] = "24.88";
260 use_scalable_fonts = true;
261 roman_font_name = "";
263 typewriter_font_name = "";
265 auto_region_delete = true;
266 auto_reset_options = false;
267 plaintext_linelen = 65;
268 mouse_wheel_speed = 1.0;
270 check_lastfiles = true;
271 use_lastfilepos = true;
272 use_native_filedialog = true;
273 load_session = false;
275 save_compressed = false;
277 backupdir_path.erase();
278 display_graphics = true;
279 // Spellchecker settings:
280 // FIXME: this check should test the target platform (darwin)
281 #if defined(USE_MACOSX_PACKAGING)
282 spellchecker = "native";
283 #elif defined(USE_ENCHANT)
284 spellchecker = "enchant";
285 #elif defined(USE_ASPELL)
286 spellchecker = "aspell";
287 #elif defined(USE_HUNSPELL)
288 spellchecker = "hunspell";
290 spellchecker = "aspell";
292 spellchecker_accept_compound = false;
293 spellcheck_continuously = false;
294 completion_minlength = 6;
295 spellcheck_notes = true;
297 visual_cursor = false;
299 mark_foreign_language = true;
300 language_auto_begin = true;
301 language_auto_end = true;
302 language_global_options = true;
303 language_package_selection = LP_AUTO;
304 language_custom_package = "\\usepackage{babel}";
305 language_command_begin = "\\selectlanguage{$$lang}";
306 language_command_local = "\\foreignlanguage{$$lang}{";
307 sort_layouts = false;
308 group_layouts = true;
309 gui_language = "auto";
311 windows_style_tex_paths = false;
312 tex_allows_spaces = false;
313 cursor_follows_scrollbar = false;
314 scroll_below_document = false;
315 scroll_wheel_zoom = SCROLL_WHEEL_ZOOM_CTRL;
316 paragraph_markers = false;
317 mac_dontswap_ctrl_meta = false;
318 mac_like_cursor_movement = false;
319 macro_edit_style = MACRO_EDIT_INLINE_BOX;
320 dialogs_iconify_with_main = false;
321 preview = PREVIEW_OFF;
322 preview_hashed_labels = false;
323 preview_scale_factor = 1.0;
324 use_converter_cache = true;
325 use_converter_needauth_forbidden = true;
326 use_converter_needauth = true;
327 use_system_colors = false;
329 use_pixmap_cache = 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_USE_PIXMAP_CACHE:
881 lexrc >> use_pixmap_cache;
883 case RC_SPELLCHECKER:
884 lexrc >> spellchecker;
887 lexrc >> spellchecker_alt_lang;
890 lexrc >> spellchecker_esc_chars;
892 case RC_SPELLCHECK_CONTINUOUSLY:
893 lexrc >> spellcheck_continuously;
895 case RC_SPELLCHECK_NOTES:
896 lexrc >> spellcheck_notes;
899 lexrc >> make_backup;
901 case RC_SAVE_COMPRESSED:
902 lexrc >> save_compressed;
905 lexrc >> save_origin;
907 case RC_BACKUPDIR_PATH:
909 backupdir_path = os::internal_path(lexrc.getString());
911 case RC_DEFAULT_DECIMAL_POINT:
912 lexrc >> default_decimal_point;
914 case RC_DEFAULT_LENGTH_UNIT:
916 default_length_unit = (Length::UNIT) lexrc.getInteger();
918 case RC_LANGUAGE_CUSTOM_PACKAGE:
919 lexrc >> language_custom_package;
921 case RC_LANGUAGE_AUTO_BEGIN:
922 lexrc >> language_auto_begin;
924 case RC_LANGUAGE_AUTO_END:
925 lexrc >> language_auto_end;
927 case RC_LANGUAGE_GLOBAL_OPTIONS:
928 lexrc >> language_global_options;
930 case RC_LANGUAGE_PACKAGE_SELECTION:
932 switch (lexrc.getInteger()) {
934 language_package_selection = LP_AUTO;
937 language_package_selection = LP_BABEL;
940 language_package_selection = LP_CUSTOM;
943 language_package_selection = LP_NONE;
948 case RC_LANGUAGE_COMMAND_BEGIN:
949 lexrc >> language_command_begin;
951 case RC_LANGUAGE_COMMAND_END:
952 lexrc >> language_command_end;
954 case RC_LANGUAGE_COMMAND_LOCAL:
955 lexrc >> language_command_local;
957 case RC_VISUAL_CURSOR:
958 lexrc >> visual_cursor;
960 case RC_CLOSE_BUFFER_WITH_LAST_VIEW:
961 lexrc >> close_buffer_with_last_view;
964 lexrc >> auto_number;
966 case RC_MARK_FOREIGN_LANGUAGE:
967 lexrc >> mark_foreign_language;
973 fmt = lexrc.getString();
974 if (lexrc.next(true))
975 command = lexrc.getString();
976 setMover(fmt, command);
981 string from, to, command, flags;
983 from = lexrc.getString();
985 to = lexrc.getString();
986 if (lexrc.next(true))
987 command = lexrc.getString();
989 flags = lexrc.getString();
991 theConverters().erase(from, to);
993 theConverters().add(from, to, command, flags);
996 // compatibility with versions older than 1.4.0 only
998 string format, command;
999 lexrc >> format >> command;
1000 theFormats().setViewer(format, command);
1003 case RC_FILEFORMAT: {
1005 string format, extensions, shortcut;
1006 docstring prettyname;
1007 if (!(lexrc >> format >> extensions))
1009 if (ok && lexrc.next(true))
1010 prettyname = lexrc.getDocString();
1014 if(!(lexrc >> shortcut))
1016 string viewer, editor;
1017 if (ok && lexrc.next(true))
1018 viewer = lexrc.getString();
1021 if (ok && lexrc.next(true))
1022 editor = lexrc.getString();
1026 if (!(lexrc >> flags >> mime))
1028 int flgs = Format::none;
1029 while (!flags.empty()) {
1031 flags = split(flags, flag, ',');
1032 if (flag == "document")
1033 flgs |= Format::document;
1034 else if (flag == "vector")
1035 flgs |= Format::vector;
1036 else if (flag == "zipped=native")
1037 flgs |= Format::zipped_native;
1038 else if (flag == "menu=export")
1039 flgs |= Format::export_menu;
1041 LYXERR0("Ignoring unknown flag `"
1042 << flag << "' for format `"
1046 LYXERR0("Syntax error in format " << format);
1047 else if (prettyname.empty()) {
1048 if (theConverters().formatIsUsed(format))
1049 LYXERR0("Can't delete format " << format);
1051 theFormats().erase(format);
1053 theFormats().add(format, extensions, prettyname,
1054 shortcut, viewer, editor, mime, flgs);
1058 case RC_VIEWER_ALTERNATIVES: {
1059 string format, command;
1060 if ((lexrc >> format) && lexrc.next(true)) {
1061 command = lexrc.getString();
1062 viewer_alternatives[format].insert(command);
1066 case RC_EDITOR_ALTERNATIVES: {
1067 string format, command;
1068 if ((lexrc >> format) && lexrc.next(true)) {
1069 command = lexrc.getString();
1070 editor_alternatives[format].insert(command);
1075 case RC_DEFAULT_OTF_VIEW_FORMAT:
1076 lexrc >> default_otf_view_format;
1079 case RC_DEFAULT_PLATEX_VIEW_FORMAT:
1080 lexrc >> default_platex_view_format;
1083 case RC_DEFAULT_VIEW_FORMAT:
1084 lexrc >> default_view_format;
1087 case RC_GUI_LANGUAGE:
1088 lexrc >> gui_language;
1091 case RC_SHOW_BANNER:
1092 lexrc >> show_banner;
1097 string const tmp = lexrc.getString();
1098 if (tmp == "true" || tmp == "on")
1099 preview = PREVIEW_ON;
1100 else if (tmp == "no_math")
1101 preview = PREVIEW_NO_MATH;
1103 preview = PREVIEW_OFF;
1104 if (tmp != "false" && tmp != "off")
1105 LYXERR0("Unrecognized preview status \""
1111 case RC_PREVIEW_HASHED_LABELS:
1112 lexrc >> preview_hashed_labels;
1115 case RC_PREVIEW_SCALE_FACTOR:
1116 lexrc >> preview_scale_factor;
1123 lexrc >> user_email;
1126 case RC_PATH_PREFIX:
1127 lexrc >> path_prefix;
1130 case RC_USE_CONVERTER_CACHE:
1131 lexrc >> use_converter_cache;
1133 case RC_USE_CONVERTER_NEEDAUTH_FORBIDDEN:
1134 lexrc >> use_converter_needauth_forbidden;
1136 case RC_USE_CONVERTER_NEEDAUTH:
1137 lexrc >> use_converter_needauth;
1139 case RC_CONVERTER_CACHE_MAXAGE:
1140 lexrc >> converter_cache_maxage;
1143 case RC_SORT_LAYOUTS:
1144 lexrc >> sort_layouts;
1146 case RC_GROUP_LAYOUTS:
1147 lexrc >> group_layouts;
1149 case RC_FULL_SCREEN_LIMIT:
1150 lexrc >> full_screen_limit;
1152 case RC_FULL_SCREEN_TOOLBARS:
1153 lexrc >> full_screen_toolbars;
1155 case RC_FULL_SCREEN_SCROLLBAR:
1156 lexrc >> full_screen_scrollbar;
1158 case RC_FULL_SCREEN_STATUSBAR:
1159 lexrc >> full_screen_statusbar;
1161 case RC_FULL_SCREEN_TABBAR:
1162 lexrc >> full_screen_tabbar;
1164 case RC_FULL_SCREEN_MENUBAR:
1165 lexrc >> full_screen_menubar;
1167 case RC_FULL_SCREEN_WIDTH:
1168 lexrc >> full_screen_width;
1170 case RC_OPEN_BUFFERS_IN_TABS:
1171 lexrc >> open_buffers_in_tabs;
1173 case RC_SINGLE_CLOSE_TAB_BUTTON:
1174 lexrc >> single_close_tab_button;
1176 case RC_SINGLE_INSTANCE:
1177 lexrc >> single_instance;
1178 if (run_mode == PREFERRED)
1179 run_mode = single_instance ? USE_REMOTE : NEW_INSTANCE;
1181 case RC_FORWARD_SEARCH_DVI:
1182 if (lexrc.next(true))
1183 forward_search_dvi = lexrc.getString();
1185 case RC_FORWARD_SEARCH_PDF:
1186 if (lexrc.next(true))
1187 forward_search_pdf = lexrc.getString();
1189 case RC_EXPORT_OVERWRITE:
1191 string const tmp = lexrc.getString();
1192 if (tmp == "all" || tmp == "true")
1193 export_overwrite = ALL_FILES;
1194 else if (tmp == "main")
1195 export_overwrite = MAIN_FILE;
1197 export_overwrite = NO_FILES;
1198 if (tmp != "ask" && tmp != "false")
1199 LYXERR0("Unrecognized export_overwrite status \""
1204 case RC_SCROLL_WHEEL_ZOOM:
1206 string const tmp = lexrc.getString();
1208 scroll_wheel_zoom = SCROLL_WHEEL_ZOOM_CTRL;
1209 else if (tmp == "shift")
1210 scroll_wheel_zoom = SCROLL_WHEEL_ZOOM_SHIFT;
1211 else if (tmp == "alt")
1212 scroll_wheel_zoom = SCROLL_WHEEL_ZOOM_ALT;
1214 scroll_wheel_zoom = SCROLL_WHEEL_ZOOM_OFF;
1215 if (tmp != "off" && tmp != "false")
1216 LYXERR0("Unrecognized scroll_wheel_zoom status \""
1222 case RC_MOUSE_MIDDLEBUTTON_PASTE:
1223 lexrc >> mouse_middlebutton_paste;
1227 break; // this is just a dummy
1230 // This is triggered the first time through the loop unless
1231 // we hit a format tag.
1232 if (check_format && rc_format != LYXRC_FILEFORMAT)
1233 return FormatMismatch;
1236 /// Update converters data-structures
1237 theConverters().update(theFormats());
1238 theConverters().buildGraph();
1239 theBufferList().invalidateConverterCache();
1245 void LyXRC::write(FileName const & filename, bool ignore_system_lyxrc) const
1247 ofstream ofs(filename.toFilesystemEncoding().c_str());
1249 write(ofs, ignore_system_lyxrc);
1253 void LyXRC::print() const
1255 if (lyxerr.debugging())
1256 write(lyxerr, false);
1264 typedef pair<string, SpecialisedMover> Data;
1266 SameMover(Data const & comparison)
1267 : comparison_(comparison) {}
1269 bool operator()(Data const & data) const
1271 return data.first == comparison_.first &&
1272 data.second.command() == comparison_.second.command();
1282 // Escape \ and " so that LyXLex can read the string later
1283 string escapeCommand(string const & str) {
1284 return subst(subst(str , "\\", "\\\\"),
1291 void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) const
1293 LyXRCTags tag = RC_LAST;
1295 if (!name.empty()) {
1296 for (int i = 0; i != lyxrcCount; ++i)
1297 if ("\\" + name == lyxrcTags[i].tag)
1298 tag = static_cast<LyXRCTags>(lyxrcTags[i].code);
1302 os << "# LyX " << lyx_version
1303 << " generated this file. If you want to make your own\n"
1304 << "# modifications you should do them from inside LyX and save.\n\n"
1305 << "Format " << LYXRC_FILEFORMAT << "\n\n";
1307 // Why the switch you might ask. It is a trick to ensure that all
1308 // the elements in the LyXRCTags enum are handled. As you can see
1309 // there are no breaks at all. So it is just a huge fall-through.
1310 // The nice thing is that we will get a warning from the compiler
1311 // if we forget an element.
1315 // input/include files are not done here
1316 case RC_LYXRCFORMAT:
1318 if (ignore_system_lyxrc ||
1319 bind_file != system_lyxrc.bind_file) {
1320 string const path = os::external_path(bind_file);
1321 os << "\\bind_file \"" << path << "\"\n";
1327 if (ignore_system_lyxrc ||
1328 def_file != system_lyxrc.def_file) {
1329 string const path = os::external_path(def_file);
1330 os << "\\def_file \"" << path << "\"\n";
1339 << "# MISC SECTION ######################################\n"
1341 // bind files are not done here.
1343 case RC_PATH_PREFIX:
1344 if (ignore_system_lyxrc ||
1345 path_prefix != system_lyxrc.path_prefix) {
1346 os << "\\path_prefix \"" << path_prefix << "\"\n";
1352 if (ignore_system_lyxrc ||
1353 ui_file != system_lyxrc.ui_file) {
1354 string const path = os::external_path(ui_file);
1355 os << "\\ui_file \"" << path << "\"\n";
1360 case RC_AUTOREGIONDELETE:
1361 if (ignore_system_lyxrc ||
1362 auto_region_delete != system_lyxrc.auto_region_delete) {
1363 os << "# Set to false to inhibit automatic replacement of\n"
1364 << "# the current selection.\n"
1365 << "\\auto_region_delete " << convert<string>(auto_region_delete)
1371 case RC_AUTORESET_OPTIONS:
1372 if (ignore_system_lyxrc ||
1373 auto_reset_options != system_lyxrc.auto_reset_options) {
1374 os << "# Set to false to inhibit automatic reset of\n"
1375 << "# the class options to defaults on class change.\n"
1376 << "\\auto_reset_options "
1377 << convert<string>(auto_reset_options)
1384 if (ignore_system_lyxrc ||
1385 autosave != system_lyxrc.autosave) {
1386 os << "# The time interval between auto-saves in seconds.\n"
1387 << "\\autosave " << autosave << '\n';
1392 case RC_DISPLAY_GRAPHICS:
1393 if (ignore_system_lyxrc ||
1394 display_graphics != system_lyxrc.display_graphics) {
1395 os << "# Display graphics within LyX\n"
1397 << "\\display_graphics "
1398 << (display_graphics ? "true" : "false")
1404 case RC_SORT_LAYOUTS:
1405 if (ignore_system_lyxrc ||
1406 sort_layouts != system_lyxrc.sort_layouts) {
1407 os << "# Sort layouts alphabetically.\n"
1408 << "\\sort_layouts " << convert<string>(sort_layouts) << '\n';
1413 case RC_GROUP_LAYOUTS:
1414 if (ignore_system_lyxrc ||
1415 group_layouts != system_lyxrc.group_layouts) {
1416 os << "# Group layouts by their category.\n"
1417 << "\\group_layouts " << convert<string>(group_layouts) << '\n';
1422 case RC_VIEWDVI_PAPEROPTION:
1423 if (ignore_system_lyxrc ||
1424 view_dvi_paper_option
1425 != system_lyxrc.view_dvi_paper_option) {
1426 os << "# Options used to specify paper size to the\n"
1427 << "# view_dvi_command (e.g. -paper)\n"
1428 << "\\view_dvi_paper_option \""
1429 << view_dvi_paper_option << "\"\n";
1434 case RC_CHKTEX_COMMAND:
1435 if (ignore_system_lyxrc ||
1436 chktex_command != system_lyxrc.chktex_command) {
1437 os << "\\chktex_command \"" << escapeCommand(chktex_command) << "\"\n";
1442 case RC_BIBTEX_ALTERNATIVES: {
1443 CommandSet::const_iterator it = bibtex_alternatives.begin();
1444 CommandSet::const_iterator end = bibtex_alternatives.end();
1445 for ( ; it != end; ++it) {
1446 if (ignore_system_lyxrc
1447 || !system_lyxrc.bibtex_alternatives.count(*it))
1448 os << "\\bibtex_alternatives \""
1455 case RC_BIBTEX_COMMAND:
1456 if (ignore_system_lyxrc ||
1457 bibtex_command != system_lyxrc.bibtex_command) {
1458 os << "\\bibtex_command \"" << escapeCommand(bibtex_command) << "\"\n";
1463 case RC_JBIBTEX_COMMAND:
1464 if (ignore_system_lyxrc ||
1465 jbibtex_command != system_lyxrc.jbibtex_command) {
1466 os << "\\jbibtex_command \"" << escapeCommand(jbibtex_command) << "\"\n";
1471 case RC_JBIBTEX_ALTERNATIVES: {
1472 CommandSet::const_iterator it = jbibtex_alternatives.begin();
1473 CommandSet::const_iterator end = jbibtex_alternatives.end();
1474 for ( ; it != end; ++it) {
1475 if (ignore_system_lyxrc
1476 || !system_lyxrc.jbibtex_alternatives.count(*it))
1477 os << "\\jbibtex_alternatives \""
1484 case RC_INDEX_ALTERNATIVES: {
1485 CommandSet::const_iterator it = index_alternatives.begin();
1486 CommandSet::const_iterator end = index_alternatives.end();
1487 for ( ; it != end; ++it) {
1488 if (ignore_system_lyxrc
1489 || !system_lyxrc.index_alternatives.count(*it))
1490 os << "\\index_alternatives \""
1497 case RC_INDEX_COMMAND:
1498 if (ignore_system_lyxrc ||
1499 index_command != system_lyxrc.index_command) {
1500 os << "\\index_command \"" << escapeCommand(index_command) << "\"\n";
1505 case RC_JINDEX_COMMAND:
1506 if (ignore_system_lyxrc ||
1507 jindex_command != system_lyxrc.jindex_command) {
1508 os << "\\jindex_command \"" << escapeCommand(jindex_command) << "\"\n";
1513 case RC_SPLITINDEX_COMMAND:
1514 if (ignore_system_lyxrc ||
1515 splitindex_command != system_lyxrc.splitindex_command) {
1516 os << "\\splitindex_command \"" << escapeCommand(splitindex_command) << "\"\n";
1521 case RC_NOMENCL_COMMAND:
1522 if (ignore_system_lyxrc ||
1523 nomencl_command != system_lyxrc.nomencl_command) {
1524 os << "\\nomencl_command \"" << escapeCommand(nomencl_command) << "\"\n";
1529 case RC_PYGMENTIZE_COMMAND:
1530 if (ignore_system_lyxrc ||
1531 pygmentize_command != system_lyxrc.pygmentize_command) {
1532 os << "\\pygmentize_command \"" << escapeCommand(pygmentize_command) << "\"\n";
1537 case RC_TEX_EXPECTS_WINDOWS_PATHS:
1538 // Don't write this setting to the preferences file,
1539 // but allow temporary changes (bug 7557).
1540 if (ignore_system_lyxrc) {
1541 os << "\\tex_expects_windows_paths "
1542 << convert<string>(windows_style_tex_paths) << '\n';
1547 case RC_TEX_ALLOWS_SPACES:
1548 if (tex_allows_spaces != system_lyxrc.tex_allows_spaces) {
1549 os << "\\tex_allows_spaces "
1550 << convert<string>(tex_allows_spaces) << '\n';
1556 if (ignore_system_lyxrc ||
1557 use_kbmap != system_lyxrc.use_kbmap) {
1558 os << "\\kbmap " << convert<string>(use_kbmap) << '\n';
1563 case RC_KBMAP_PRIMARY:
1564 if (ignore_system_lyxrc ||
1565 primary_kbmap != system_lyxrc.primary_kbmap) {
1566 string const path = os::external_path(primary_kbmap);
1567 os << "\\kbmap_primary \"" << path << "\"\n";
1572 case RC_KBMAP_SECONDARY:
1573 if (ignore_system_lyxrc ||
1574 secondary_kbmap != system_lyxrc.secondary_kbmap) {
1575 string const path = os::external_path(secondary_kbmap);
1576 os << "\\kbmap_secondary \"" << path << "\"\n";
1582 if (ignore_system_lyxrc ||
1583 lyxpipes != system_lyxrc.lyxpipes) {
1584 string const path = os::external_path(lyxpipes);
1585 os << "\\serverpipe \"" << path << "\"\n";
1591 os << "\\user_name \"" << user_name << "\"\n";
1596 os << "\\user_email \"" << user_email << "\"\n";
1600 case RC_SHOW_BANNER:
1601 if (ignore_system_lyxrc ||
1602 show_banner != system_lyxrc.show_banner) {
1603 os << "\\show_banner " << convert<string>(show_banner) << '\n';
1609 if (ignore_system_lyxrc ||
1610 preview != system_lyxrc.preview) {
1616 case PREVIEW_NO_MATH:
1623 os << "\\preview " << status << '\n';
1628 case RC_PREVIEW_HASHED_LABELS:
1629 if (ignore_system_lyxrc ||
1630 preview_hashed_labels !=
1631 system_lyxrc.preview_hashed_labels) {
1632 os << "\\preview_hashed_labels "
1633 << convert<string>(preview_hashed_labels) << '\n';
1638 case RC_PREVIEW_SCALE_FACTOR:
1639 if (ignore_system_lyxrc ||
1640 preview_scale_factor != system_lyxrc.preview_scale_factor) {
1641 os << "\\preview_scale_factor "
1642 << preview_scale_factor << '\n';
1647 case RC_USE_CONVERTER_CACHE:
1648 if (ignore_system_lyxrc ||
1649 use_converter_cache != system_lyxrc.use_converter_cache) {
1650 os << "\\use_converter_cache "
1651 << convert<string>(use_converter_cache) << '\n';
1656 case RC_USE_CONVERTER_NEEDAUTH_FORBIDDEN:
1657 if (ignore_system_lyxrc ||
1658 use_converter_needauth_forbidden != system_lyxrc.use_converter_needauth_forbidden) {
1659 os << "\\use_converter_needauth_forbidden "
1660 << convert<string>(use_converter_needauth_forbidden) << '\n';
1665 case RC_USE_CONVERTER_NEEDAUTH:
1666 if (ignore_system_lyxrc ||
1667 use_converter_needauth != system_lyxrc.use_converter_needauth) {
1668 os << "\\use_converter_needauth "
1669 << convert<string>(use_converter_needauth) << '\n';
1674 case RC_CONVERTER_CACHE_MAXAGE:
1675 if (ignore_system_lyxrc ||
1676 converter_cache_maxage != system_lyxrc.converter_cache_maxage) {
1677 os << "\\converter_cache_maxage "
1678 << converter_cache_maxage << '\n';
1684 << "# SCREEN & FONTS SECTION ############################\n"
1688 if (ignore_system_lyxrc ||
1689 icon_set != system_lyxrc.icon_set) {
1690 os << "\\icon_set \"" << icon_set
1696 case RC_USE_SYSTEM_THEME_ICONS:
1697 if (ignore_system_lyxrc ||
1698 use_system_theme_icons != system_lyxrc.use_system_theme_icons) {
1699 os << "\\use_system_theme_icons "
1700 << convert<string>(use_system_theme_icons)
1707 if (ignore_system_lyxrc ||
1708 dpi != system_lyxrc.dpi) {
1709 os << "\\screen_dpi " << dpi << '\n';
1714 case RC_SCREEN_ZOOM:
1715 if (ignore_system_lyxrc ||
1716 defaultZoom != system_lyxrc.defaultZoom) {
1717 os << "\\screen_zoom " << defaultZoom << '\n';
1722 case RC_GEOMETRY_SESSION:
1723 if (ignore_system_lyxrc ||
1724 allow_geometry_session != system_lyxrc.allow_geometry_session) {
1725 os << "\\allow_geometry_session " << convert<string>(allow_geometry_session)
1731 case RC_CURSOR_FOLLOWS_SCROLLBAR:
1732 if (ignore_system_lyxrc ||
1733 cursor_follows_scrollbar
1734 != system_lyxrc.cursor_follows_scrollbar) {
1735 os << "\\cursor_follows_scrollbar "
1736 << convert<string>(cursor_follows_scrollbar) << '\n';
1741 case RC_CURSOR_WIDTH:
1742 if (ignore_system_lyxrc ||
1744 != system_lyxrc.cursor_width) {
1745 os << "\\cursor_width "
1746 << cursor_width << '\n';
1751 case RC_SCROLL_BELOW_DOCUMENT:
1752 if (ignore_system_lyxrc ||
1753 scroll_below_document
1754 != system_lyxrc.scroll_below_document) {
1755 os << "\\scroll_below_document "
1756 << convert<string>(scroll_below_document) << '\n';
1761 case RC_PARAGRAPH_MARKERS:
1762 if (ignore_system_lyxrc ||
1764 != system_lyxrc.paragraph_markers) {
1765 os << "\\paragraph_markers "
1766 << convert<string>(paragraph_markers) << '\n';
1771 case RC_MAC_DONTSWAP_CTRL_META:
1772 if (ignore_system_lyxrc ||
1773 mac_dontswap_ctrl_meta
1774 != system_lyxrc.mac_dontswap_ctrl_meta) {
1775 os << "\\mac_dontswap_ctrl_meta "
1776 << convert<string>(mac_dontswap_ctrl_meta) << '\n';
1781 case RC_MAC_LIKE_CURSOR_MOVEMENT:
1782 if (ignore_system_lyxrc ||
1783 mac_like_cursor_movement
1784 != system_lyxrc.mac_like_cursor_movement) {
1785 os << "\\mac_like_cursor_movement "
1786 << convert<string>(mac_like_cursor_movement) << '\n';
1791 case RC_MACRO_EDIT_STYLE:
1792 if (ignore_system_lyxrc ||
1794 != system_lyxrc.macro_edit_style) {
1795 os << "\\macro_edit_style ";
1796 switch (macro_edit_style) {
1797 case MACRO_EDIT_INLINE_BOX: os << "0\n"; break;
1798 case MACRO_EDIT_INLINE: os << "1\n"; break;
1799 case MACRO_EDIT_LIST: os << "2\n"; break;
1805 case RC_DIALOGS_ICONIFY_WITH_MAIN:
1806 if (ignore_system_lyxrc ||
1807 dialogs_iconify_with_main
1808 != system_lyxrc.dialogs_iconify_with_main) {
1809 os << "\\dialogs_iconify_with_main "
1810 << convert<string>(dialogs_iconify_with_main) << '\n';
1815 case RC_SCREEN_FONT_ROMAN:
1816 if (ignore_system_lyxrc ||
1817 roman_font_name != system_lyxrc.roman_font_name) {
1818 os << "\\screen_font_roman \"" << roman_font_name
1824 case RC_SCREEN_FONT_ROMAN_FOUNDRY:
1825 if (ignore_system_lyxrc ||
1826 roman_font_foundry != system_lyxrc.roman_font_foundry) {
1827 os << "\\screen_font_roman_foundry \"" << roman_font_foundry
1833 case RC_SCREEN_FONT_SANS:
1834 if (ignore_system_lyxrc ||
1835 sans_font_name != system_lyxrc.sans_font_name) {
1836 os << "\\screen_font_sans \"" << sans_font_name
1842 case RC_SCREEN_FONT_SANS_FOUNDRY:
1843 if (ignore_system_lyxrc ||
1844 sans_font_foundry != system_lyxrc.sans_font_foundry) {
1845 os << "\\screen_font_sans_foundry \"" << sans_font_foundry
1851 case RC_SCREEN_FONT_TYPEWRITER:
1852 if (ignore_system_lyxrc ||
1853 typewriter_font_name != system_lyxrc.typewriter_font_name) {
1854 os << "\\screen_font_typewriter \""
1855 << typewriter_font_name << "\"\n";
1860 case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
1861 if (ignore_system_lyxrc ||
1862 typewriter_font_foundry != system_lyxrc.typewriter_font_foundry) {
1863 os << "\\screen_font_typewriter_foundry \""
1864 << typewriter_font_foundry << "\"\n";
1869 case RC_SCREEN_FONT_SCALABLE:
1870 if (ignore_system_lyxrc ||
1871 use_scalable_fonts != system_lyxrc.use_scalable_fonts) {
1872 os << "\\screen_font_scalable "
1873 << convert<string>(use_scalable_fonts)
1879 case RC_SCREEN_FONT_SIZES:
1880 if (ignore_system_lyxrc ||
1881 font_sizes[FONT_SIZE_TINY]
1882 != system_lyxrc.font_sizes[FONT_SIZE_TINY] ||
1883 font_sizes[FONT_SIZE_SCRIPT]
1884 != system_lyxrc.font_sizes[FONT_SIZE_SCRIPT] ||
1885 font_sizes[FONT_SIZE_FOOTNOTE]
1886 != system_lyxrc.font_sizes[FONT_SIZE_FOOTNOTE] ||
1887 font_sizes[FONT_SIZE_SMALL]
1888 != system_lyxrc.font_sizes[FONT_SIZE_SMALL] ||
1889 font_sizes[FONT_SIZE_NORMAL]
1890 != system_lyxrc.font_sizes[FONT_SIZE_NORMAL] ||
1891 font_sizes[FONT_SIZE_LARGE]
1892 != system_lyxrc.font_sizes[FONT_SIZE_LARGE] ||
1893 font_sizes[FONT_SIZE_LARGER]
1894 != system_lyxrc.font_sizes[FONT_SIZE_LARGER] ||
1895 font_sizes[FONT_SIZE_LARGEST]
1896 != system_lyxrc.font_sizes[FONT_SIZE_LARGEST] ||
1897 font_sizes[FONT_SIZE_HUGE]
1898 != system_lyxrc.font_sizes[FONT_SIZE_HUGE] ||
1899 font_sizes[FONT_SIZE_HUGER]
1900 != system_lyxrc.font_sizes[FONT_SIZE_HUGER]) {
1901 streamsize old_prec = os.precision();
1902 os.setf(ios::fixed);
1904 os << "\\screen_font_sizes"
1905 << ' ' << font_sizes[FONT_SIZE_TINY]
1906 << ' ' << font_sizes[FONT_SIZE_SCRIPT]
1907 << ' ' << font_sizes[FONT_SIZE_FOOTNOTE]
1908 << ' ' << font_sizes[FONT_SIZE_SMALL]
1909 << ' ' << font_sizes[FONT_SIZE_NORMAL]
1910 << ' ' << font_sizes[FONT_SIZE_LARGE]
1911 << ' ' << font_sizes[FONT_SIZE_LARGER]
1912 << ' ' << font_sizes[FONT_SIZE_LARGEST]
1913 << ' ' << font_sizes[FONT_SIZE_HUGE]
1914 << ' ' << font_sizes[FONT_SIZE_HUGER]
1916 os.precision(old_prec);
1917 os.unsetf(ios::fixed);
1922 case RC_FULL_SCREEN_LIMIT:
1923 if (ignore_system_lyxrc ||
1924 full_screen_limit != system_lyxrc.full_screen_limit) {
1925 os << "\\fullscreen_limit "
1926 << convert<string>(full_screen_limit)
1932 case RC_FULL_SCREEN_TOOLBARS:
1933 if (ignore_system_lyxrc ||
1934 full_screen_toolbars != system_lyxrc.full_screen_toolbars) {
1935 os << "\\fullscreen_toolbars "
1936 << convert<string>(full_screen_toolbars)
1942 case RC_FULL_SCREEN_SCROLLBAR:
1943 if (ignore_system_lyxrc ||
1944 full_screen_scrollbar != system_lyxrc.full_screen_scrollbar) {
1945 os << "\\fullscreen_scrollbar "
1946 << convert<string>(full_screen_scrollbar)
1952 case RC_FULL_SCREEN_STATUSBAR:
1953 if (ignore_system_lyxrc ||
1954 full_screen_statusbar != system_lyxrc.full_screen_statusbar) {
1955 os << "\\fullscreen_statusbar "
1956 << convert<string>(full_screen_statusbar)
1962 case RC_FULL_SCREEN_TABBAR:
1963 if (ignore_system_lyxrc ||
1964 full_screen_tabbar != system_lyxrc.full_screen_tabbar) {
1965 os << "\\fullscreen_tabbar "
1966 << convert<string>(full_screen_tabbar)
1972 case RC_FULL_SCREEN_MENUBAR:
1973 if (ignore_system_lyxrc ||
1974 full_screen_menubar != system_lyxrc.full_screen_menubar) {
1975 os << "\\fullscreen_menubar "
1976 << 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)
1992 case RC_OPEN_BUFFERS_IN_TABS:
1993 if (ignore_system_lyxrc ||
1994 open_buffers_in_tabs != system_lyxrc.open_buffers_in_tabs) {
1995 os << "\\open_buffers_in_tabs "
1996 << convert<string>(open_buffers_in_tabs)
2002 case RC_SINGLE_CLOSE_TAB_BUTTON:
2003 if (ignore_system_lyxrc ||
2004 single_close_tab_button != system_lyxrc.single_close_tab_button) {
2005 os << "\\single_close_tab_button "
2006 << convert<string>(single_close_tab_button)
2012 case RC_SINGLE_INSTANCE:
2013 if (ignore_system_lyxrc ||
2014 single_instance != system_lyxrc.single_instance) {
2015 os << "\\single_instance "
2016 << convert<string>(single_instance)
2022 case RC_FORWARD_SEARCH_DVI:
2023 if (ignore_system_lyxrc ||
2024 forward_search_dvi != system_lyxrc.forward_search_dvi) {
2025 os << "\\forward_search_dvi \"" << escapeCommand(forward_search_dvi) << "\"\n";
2030 case RC_FORWARD_SEARCH_PDF:
2031 if (ignore_system_lyxrc ||
2032 forward_search_pdf != system_lyxrc.forward_search_pdf) {
2033 os << "\\forward_search_pdf \"" << escapeCommand(forward_search_pdf) << "\"\n";
2039 << "# COLOR SECTION ###################################\n"
2044 for (int i = 0; i < Color_ignore; ++i) {
2045 ColorCode lc = static_cast<ColorCode>(i);
2046 string const col = lcolor.getX11Name(lc);
2047 if (ignore_system_lyxrc
2048 || col != system_lcolor.getX11Name(lc)) {
2049 os << "\\set_color \""
2050 << lcolor.getLyXName(lc) << "\" \""
2058 << "# PRINTER SECTION ###################################\n"
2062 case RC_PRINTLANDSCAPEFLAG:
2063 if (ignore_system_lyxrc ||
2064 print_landscape_flag != system_lyxrc.print_landscape_flag) {
2065 os << "\\print_landscape_flag \"" << print_landscape_flag
2071 case RC_PRINTPAPERFLAG:
2072 if (ignore_system_lyxrc ||
2073 print_paper_flag != system_lyxrc.print_paper_flag) {
2074 os << "\\print_paper_flag \"" << print_paper_flag
2080 case RC_PRINTPAPERDIMENSIONFLAG:
2081 if (ignore_system_lyxrc ||
2082 print_paper_dimension_flag
2083 != system_lyxrc.print_paper_dimension_flag) {
2084 os << "\\print_paper_dimension_flag \""
2085 << print_paper_dimension_flag << "\"\n";
2091 << "# TEX SECTION #######################################\n"
2095 case RC_TEXINPUTS_PREFIX:
2096 if (ignore_system_lyxrc ||
2097 texinputs_prefix != system_lyxrc.texinputs_prefix) {
2098 os << "\\texinputs_prefix \"" << texinputs_prefix << "\"\n";
2104 << "# FILE SECTION ######################################\n"
2107 case RC_DOCUMENTPATH:
2108 if (ignore_system_lyxrc ||
2109 document_path != system_lyxrc.document_path) {
2110 string const path = os::external_path(document_path);
2111 os << "\\document_path \"" << path << "\"\n";
2116 case RC_USELASTFILEPOS:
2117 if (ignore_system_lyxrc ||
2118 use_lastfilepos != system_lyxrc.use_lastfilepos) {
2119 os << "\\use_lastfilepos " << convert<string>(use_lastfilepos)
2125 case RC_LOADSESSION:
2126 if (ignore_system_lyxrc ||
2127 load_session != system_lyxrc.load_session) {
2128 os << "\\load_session " << convert<string>(load_session)
2134 case RC_MOUSE_WHEEL_SPEED:
2135 if (ignore_system_lyxrc ||
2136 mouse_wheel_speed != system_lyxrc.mouse_wheel_speed) {
2137 os << "\\mouse_wheel_speed " << mouse_wheel_speed << '\n';
2142 case RC_MOUSE_MIDDLEBUTTON_PASTE:
2143 if (ignore_system_lyxrc ||
2144 mouse_middlebutton_paste != system_lyxrc.mouse_middlebutton_paste) {
2145 os << "\\mouse_middlebutton_paste "
2146 << convert<string>(mouse_middlebutton_paste) << '\n';
2151 case RC_COMPLETION_INLINE_DELAY:
2152 if (ignore_system_lyxrc ||
2153 completion_inline_delay != system_lyxrc.completion_inline_delay) {
2154 os << "\\completion_inline_delay " << completion_inline_delay << '\n';
2159 case RC_COMPLETION_INLINE_MATH:
2160 if (ignore_system_lyxrc ||
2161 completion_inline_math != system_lyxrc.completion_inline_math) {
2162 os << "\\completion_inline_math "
2163 << convert<string>(completion_inline_math) << '\n';
2168 case RC_COMPLETION_INLINE_TEXT:
2169 if (ignore_system_lyxrc ||
2170 completion_inline_text != system_lyxrc.completion_inline_text) {
2171 os << "\\completion_inline_text "
2172 << convert<string>(completion_inline_text) << '\n';
2177 case RC_COMPLETION_INLINE_DOTS:
2178 if (ignore_system_lyxrc ||
2179 completion_inline_dots != system_lyxrc.completion_inline_dots) {
2180 os << "\\completion_inline_dots "
2181 << convert<string>(completion_inline_dots) << '\n';
2186 case RC_AUTOCORRECTION_MATH:
2187 if (ignore_system_lyxrc ||
2188 autocorrection_math != system_lyxrc.autocorrection_math) {
2189 os << "\\autocorrection_math "
2190 << convert<string>(autocorrection_math) << '\n';
2195 case RC_COMPLETION_POPUP_DELAY:
2196 if (ignore_system_lyxrc ||
2197 completion_popup_delay != system_lyxrc.completion_popup_delay) {
2198 os << "\\completion_popup_delay " << completion_popup_delay << '\n';
2203 case RC_COMPLETION_POPUP_MATH:
2204 if (ignore_system_lyxrc ||
2205 completion_popup_math != system_lyxrc.completion_popup_math) {
2206 os << "\\completion_popup_math "
2207 << convert<string>(completion_popup_math) << '\n';
2212 case RC_COMPLETION_POPUP_TEXT:
2213 if (ignore_system_lyxrc ||
2214 completion_popup_text != system_lyxrc.completion_popup_text) {
2215 os << "\\completion_popup_text "
2216 << convert<string>(completion_popup_text) << '\n';
2221 case RC_COMPLETION_CURSOR_TEXT:
2222 if (ignore_system_lyxrc ||
2223 completion_cursor_text != system_lyxrc.completion_cursor_text) {
2224 os << "\\completion_cursor_text "
2225 << convert<string>(completion_cursor_text) << '\n';
2230 case RC_COMPLETION_POPUP_AFTER_COMPLETE:
2231 if (ignore_system_lyxrc ||
2232 completion_popup_after_complete
2233 != system_lyxrc.completion_popup_after_complete) {
2234 os << "\\completion_popup_after_complete "
2235 << convert<string>(completion_popup_after_complete) << '\n';
2240 case RC_COMPLETION_MINLENGTH:
2241 if (ignore_system_lyxrc ||
2242 completion_minlength != system_lyxrc.completion_minlength) {
2243 os << "\\completion_minlength " << convert<string>(completion_minlength)
2249 case RC_NUMLASTFILES:
2250 if (ignore_system_lyxrc ||
2251 num_lastfiles != system_lyxrc.num_lastfiles) {
2252 os << "\\num_lastfiles " << num_lastfiles << '\n';
2257 case RC_CHECKLASTFILES:
2258 if (ignore_system_lyxrc ||
2259 check_lastfiles != system_lyxrc.check_lastfiles) {
2260 os << "\\check_lastfiles " << convert<string>(check_lastfiles)
2266 case RC_EXAMPLEPATH:
2267 if (ignore_system_lyxrc ||
2268 example_path != system_lyxrc.example_path) {
2269 string const path = os::external_path(example_path);
2270 os << "\\example_path \"" << path << "\"\n";
2275 case RC_TEMPLATEPATH:
2276 if (ignore_system_lyxrc ||
2277 template_path != system_lyxrc.template_path) {
2278 string const path = os::external_path(template_path);
2279 os << "\\template_path \"" << path << "\"\n";
2284 case RC_TEMPDIRPATH:
2285 if (ignore_system_lyxrc ||
2286 tempdir_path != system_lyxrc.tempdir_path) {
2287 string const path = os::external_path(tempdir_path);
2288 os << "\\tempdir_path \"" << path << "\"\n";
2293 case RC_THESAURUSDIRPATH:
2294 if (ignore_system_lyxrc ||
2295 thesaurusdir_path != system_lyxrc.thesaurusdir_path) {
2296 string const path = os::external_path(thesaurusdir_path);
2297 os << "\\thesaurusdir_path \"" << path << "\"\n";
2302 case RC_HUNSPELLDIR_PATH:
2303 if (ignore_system_lyxrc ||
2304 hunspelldir_path != system_lyxrc.hunspelldir_path) {
2305 string const path = os::external_path(hunspelldir_path);
2306 os << "\\hunspelldir_path \"" << path << "\"\n";
2311 case RC_PLAINTEXT_LINELEN:
2312 if (ignore_system_lyxrc ||
2313 plaintext_linelen != system_lyxrc.plaintext_linelen) {
2314 os << "\\plaintext_linelen " << plaintext_linelen << '\n';
2319 case RC_MAKE_BACKUP:
2320 if (ignore_system_lyxrc ||
2321 make_backup != system_lyxrc.make_backup) {
2322 os << "\\make_backup " << convert<string>(make_backup) << '\n';
2327 case RC_SAVE_COMPRESSED:
2328 if (ignore_system_lyxrc ||
2329 save_compressed != system_lyxrc.save_compressed) {
2330 os << "\\save_compressed " << convert<string>(save_compressed) << '\n';
2335 case RC_SAVE_ORIGIN:
2336 if (ignore_system_lyxrc ||
2337 save_origin != system_lyxrc.save_origin) {
2338 os << "\\save_origin " << convert<string>(save_origin) << '\n';
2343 case RC_BACKUPDIR_PATH:
2344 if (ignore_system_lyxrc ||
2345 backupdir_path != system_lyxrc.backupdir_path) {
2346 string const path = os::external_path(backupdir_path);
2347 os << "\\backupdir_path \"" << path << "\"\n";
2353 << "# PLAIN TEXT EXPORT SECTION ##############################\n"
2357 << "# SPELLCHECKER SECTION ##############################\n"
2361 case RC_ACCEPT_COMPOUND:
2362 if (ignore_system_lyxrc ||
2363 spellchecker_accept_compound != system_lyxrc.spellchecker_accept_compound) {
2364 os << "\\accept_compound " << convert<string>(spellchecker_accept_compound)
2371 if (ignore_system_lyxrc ||
2372 spellchecker_alt_lang != system_lyxrc.spellchecker_alt_lang) {
2373 os << "\\alternate_language \"" << spellchecker_alt_lang
2380 if (ignore_system_lyxrc ||
2381 spellchecker_esc_chars != system_lyxrc.spellchecker_esc_chars) {
2382 os << "\\escape_chars \"" << spellchecker_esc_chars << "\"\n";
2387 case RC_USE_NATIVE_FILEDIALOG:
2388 if (ignore_system_lyxrc ||
2389 use_native_filedialog != system_lyxrc.use_native_filedialog) {
2390 os << "\\use_native_filedialog "
2391 << convert<string>(use_native_filedialog)
2397 case RC_USE_SYSTEM_COLORS:
2398 if (ignore_system_lyxrc ||
2399 use_system_colors != system_lyxrc.use_system_colors) {
2400 os << "\\use_system_colors "
2401 << convert<string>(use_system_colors)
2407 case RC_USE_TOOLTIP:
2408 if (ignore_system_lyxrc ||
2409 use_tooltip != system_lyxrc.use_tooltip) {
2410 os << "\\use_tooltip "
2411 << convert<string>(use_tooltip)
2417 case RC_USE_PIXMAP_CACHE:
2418 if (ignore_system_lyxrc ||
2419 use_pixmap_cache != system_lyxrc.use_pixmap_cache) {
2420 os << "\\use_pixmap_cache "
2421 << convert<string>(use_pixmap_cache)
2429 << "# LANGUAGE SUPPORT SECTION ##########################\n"
2433 case RC_DEFAULT_DECIMAL_POINT:
2434 if (ignore_system_lyxrc ||
2435 default_decimal_point != system_lyxrc.default_decimal_point) {
2436 os << "\\default_decimal_point " << default_decimal_point << '\n';
2441 case RC_DEFAULT_LENGTH_UNIT:
2442 if (ignore_system_lyxrc ||
2443 default_length_unit != system_lyxrc.default_length_unit) {
2444 os << "\\default_length_unit " << int(default_length_unit) << '\n';
2449 case RC_SPELLCHECKER:
2450 if (ignore_system_lyxrc ||
2451 spellchecker != system_lyxrc.spellchecker) {
2452 os << "\\spellchecker " << spellchecker << '\n';
2457 case RC_SPELLCHECK_CONTINUOUSLY:
2458 if (ignore_system_lyxrc ||
2459 spellcheck_continuously != system_lyxrc.spellcheck_continuously) {
2460 os << "\\spellcheck_continuously " << convert<string>(spellcheck_continuously)
2466 case RC_SPELLCHECK_NOTES:
2467 if (ignore_system_lyxrc ||
2468 spellcheck_notes != system_lyxrc.spellcheck_notes) {
2469 os << "\\spellcheck_notes " << convert<string>(spellcheck_notes)
2475 case RC_VISUAL_CURSOR:
2476 if (ignore_system_lyxrc ||
2477 visual_cursor != system_lyxrc.visual_cursor) {
2478 os << "\\visual_cursor " << convert<string>(visual_cursor) << '\n';
2483 case RC_CLOSE_BUFFER_WITH_LAST_VIEW:
2484 if (ignore_system_lyxrc ||
2485 close_buffer_with_last_view != system_lyxrc.close_buffer_with_last_view) {
2486 os << "# When closing last view, buffer closes (yes), hides (no), or ask the user (ask)\n";
2487 os << "\\close_buffer_with_last_view " << close_buffer_with_last_view << '\n';
2492 case RC_LANGUAGE_CUSTOM_PACKAGE:
2493 if (ignore_system_lyxrc ||
2494 language_custom_package != system_lyxrc.language_custom_package) {
2495 os << "\\language_custom_package \"" << language_custom_package
2501 case RC_LANGUAGE_GLOBAL_OPTIONS:
2502 if (ignore_system_lyxrc ||
2503 language_global_options
2504 != system_lyxrc.language_global_options) {
2505 os << "\\language_global_options \""
2506 << convert<string>(language_global_options)
2512 case RC_LANGUAGE_PACKAGE_SELECTION:
2513 if (ignore_system_lyxrc ||
2514 language_package_selection != system_lyxrc.language_package_selection) {
2515 os << "\\language_package_selection ";
2516 switch (language_package_selection) {
2534 case RC_LANGUAGE_COMMAND_BEGIN:
2535 if (ignore_system_lyxrc ||
2536 language_command_begin
2537 != system_lyxrc.language_command_begin) {
2538 os << "\\language_command_begin \""
2539 << language_command_begin
2545 case RC_LANGUAGE_COMMAND_END:
2546 if (ignore_system_lyxrc ||
2547 language_command_end
2548 != system_lyxrc.language_command_end) {
2549 os << "\\language_command_end \"" << language_command_end
2555 case RC_LANGUAGE_COMMAND_LOCAL:
2556 if (ignore_system_lyxrc ||
2557 language_command_local
2558 != system_lyxrc.language_command_local) {
2559 os << "\\language_command_local \""
2560 << language_command_local
2566 case RC_LANGUAGE_AUTO_BEGIN:
2567 if (ignore_system_lyxrc ||
2568 language_auto_begin != system_lyxrc.language_auto_begin) {
2569 os << "\\language_auto_begin "
2570 << convert<string>(language_auto_begin) << '\n';
2575 case RC_LANGUAGE_AUTO_END:
2576 if (ignore_system_lyxrc ||
2577 language_auto_end != system_lyxrc.language_auto_end) {
2578 os << "\\language_auto_end "
2579 << convert<string>(language_auto_end) << '\n';
2584 case RC_MARK_FOREIGN_LANGUAGE:
2585 if (ignore_system_lyxrc ||
2586 mark_foreign_language
2587 != system_lyxrc.mark_foreign_language) {
2588 os << "\\mark_foreign_language " <<
2589 convert<string>(mark_foreign_language) << '\n';
2595 << "# 2nd MISC SUPPORT SECTION ##########################\n"
2599 case RC_AUTO_NUMBER:
2600 if (ignore_system_lyxrc ||
2601 auto_number != system_lyxrc.auto_number) {
2602 os << "\\auto_number " << convert<string>(auto_number) << '\n';
2607 case RC_GUI_LANGUAGE:
2608 if (ignore_system_lyxrc ||
2609 gui_language != system_lyxrc.gui_language) {
2610 os << "\\gui_language " << gui_language << '\n';
2615 case RC_EXPORT_OVERWRITE:
2616 if (ignore_system_lyxrc ||
2617 export_overwrite != system_lyxrc.export_overwrite) {
2619 switch (export_overwrite) {
2630 os << "\\export_overwrite " << status << '\n';
2635 case RC_SCROLL_WHEEL_ZOOM:
2636 if (ignore_system_lyxrc ||
2637 scroll_wheel_zoom != system_lyxrc.scroll_wheel_zoom) {
2639 switch (scroll_wheel_zoom) {
2640 case SCROLL_WHEEL_ZOOM_OFF:
2643 case SCROLL_WHEEL_ZOOM_CTRL:
2646 case SCROLL_WHEEL_ZOOM_SHIFT:
2649 case SCROLL_WHEEL_ZOOM_ALT:
2653 os << "\\scroll_wheel_zoom " << status << '\n';
2659 << "# FORMATS SECTION ##########################\n"
2664 // New/modified formats
2665 for (Formats::const_iterator cit = theFormats().begin();
2666 cit != theFormats().end(); ++cit) {
2667 Format const * format =
2668 theSystemFormats().getFormat(cit->name());
2670 format->extensions() != cit->extensions() ||
2671 format->prettyname() != cit->prettyname() ||
2672 format->shortcut() != cit->shortcut() ||
2673 format->viewer() != cit->viewer() ||
2674 format->editor() != cit->editor() ||
2675 format->documentFormat() != cit->documentFormat() ||
2676 format->vectorFormat() != cit->vectorFormat() ||
2677 format->inExportMenu() != cit->inExportMenu() ||
2678 format->mime() != cit->mime()) {
2679 os << "\\format \"" << cit->name() << "\" \""
2680 << cit->extensions() << "\" \""
2681 << to_utf8(cit->prettyname()) << "\" \""
2682 << cit->shortcut() << "\" \""
2683 << escapeCommand(cit->viewer()) << "\" \""
2684 << escapeCommand(cit->editor()) << "\" \"";
2685 vector<string> flags;
2686 if (cit->documentFormat())
2687 flags.push_back("document");
2688 if (cit->vectorFormat())
2689 flags.push_back("vector");
2690 if (cit->zippedNative())
2691 flags.push_back("zipped=native");
2692 if (cit->inExportMenu())
2693 flags.push_back("menu=export");
2695 os << getStringFromVector(flags);
2696 os << "\" \"" << cit->mime() << "\"\n";
2700 // Look for deleted formats
2701 for (Formats::const_iterator cit = theSystemFormats().begin();
2702 cit != theSystemFormats().end(); ++cit)
2703 if (!theFormats().getFormat(cit->name()))
2704 os << "\\format \"" << cit->name()
2705 << "\" \"\" \"\" \"\" \"\" \"\" \"\" \"\"\n";
2709 case RC_VIEWER_ALTERNATIVES: {
2710 Alternatives::const_iterator it = viewer_alternatives.begin();
2711 Alternatives::const_iterator const en = viewer_alternatives.end();
2712 Alternatives::const_iterator const sysend =
2713 system_lyxrc.viewer_alternatives.end();
2714 for (; it != en; ++it) {
2715 string const & fmt = it->first;
2716 CommandSet const & cmd = it->second;
2717 CommandSet::const_iterator sit = cmd.begin();
2718 CommandSet::const_iterator const sen = cmd.end();
2719 Alternatives::const_iterator const sysfmt = ignore_system_lyxrc ?
2720 system_lyxrc.viewer_alternatives.begin() : // we won't use it in this case
2721 system_lyxrc.viewer_alternatives.find(fmt);
2722 for (; sit != sen; ++sit) {
2723 string const & cmd = *sit;
2724 if (ignore_system_lyxrc
2725 || sysfmt == sysend // format not found
2726 || sysfmt->second.count(cmd) == 0 // this command not found
2728 os << "\\viewer_alternatives " << fmt << " \"" << escapeCommand(cmd) << "\"\n";
2735 case RC_EDITOR_ALTERNATIVES: {
2736 Alternatives::const_iterator it = editor_alternatives.begin();
2737 Alternatives::const_iterator const en = editor_alternatives.end();
2738 Alternatives::const_iterator const sysend =
2739 system_lyxrc.editor_alternatives.end();
2740 for (; it != en; ++it) {
2741 string const & fmt = it->first;
2742 CommandSet const & cmd = it->second;
2743 CommandSet::const_iterator sit = cmd.begin();
2744 CommandSet::const_iterator const sen = cmd.end();
2745 Alternatives::const_iterator const sysfmt = ignore_system_lyxrc ?
2746 system_lyxrc.editor_alternatives.begin() : // we won't use it in this case
2747 system_lyxrc.editor_alternatives.find(fmt);
2748 for (; sit != sen; ++sit) {
2749 string const & cmd = *sit;
2750 if (ignore_system_lyxrc
2751 || sysfmt == sysend // format not found
2752 || sysfmt->second.count(cmd) == 0 // this command not found
2754 os << "\\editor_alternatives " << fmt << " \"" << escapeCommand(cmd) << "\"\n";
2761 case RC_DEFAULT_OTF_VIEW_FORMAT:
2762 if ((ignore_system_lyxrc ||
2763 default_otf_view_format != system_lyxrc.default_otf_view_format)
2764 && !default_otf_view_format.empty()) {
2765 os << "\\default_otf_view_format " << default_otf_view_format << '\n';
2770 case RC_DEFAULT_PLATEX_VIEW_FORMAT:
2771 if ((ignore_system_lyxrc ||
2772 default_platex_view_format != system_lyxrc.default_platex_view_format)
2773 && !default_platex_view_format.empty()) {
2774 os << "\\default_platex_view_format " << default_platex_view_format << '\n';
2779 case RC_DEFAULT_VIEW_FORMAT:
2780 if (ignore_system_lyxrc ||
2781 default_view_format != system_lyxrc.default_view_format) {
2782 os << "\\default_view_format " << default_view_format << '\n';
2793 << "# CONVERTERS SECTION ##########################\n"
2798 // Look for new converters
2799 for (Converters::const_iterator cit = theConverters().begin();
2800 cit != theConverters().end(); ++cit) {
2801 Converter const * converter =
2802 theSystemConverters().getConverter(cit->from(),
2805 converter->command() != cit->command() ||
2806 converter->flags() != cit->flags())
2807 os << "\\converter \"" << cit->from() << "\" \""
2808 << cit->to() << "\" \""
2809 << escapeCommand(cit->command()) << "\" \""
2810 << cit->flags() << "\"\n";
2813 // New/modifed converters
2814 for (Converters::const_iterator cit = theSystemConverters().begin();
2815 cit != theSystemConverters().end(); ++cit)
2816 if (!theConverters().getConverter(cit->from(), cit->to()))
2817 os << "\\converter \"" << cit->from()
2818 << "\" \"" << cit->to() << "\" \"\" \"\"\n";
2825 << "# COPIERS SECTION ##########################\n"
2828 // Look for new movers
2829 Movers::const_iterator const sysbegin = theSystemMovers().begin();
2830 Movers::const_iterator const sysend = theSystemMovers().end();
2831 Movers::const_iterator it = theMovers().begin();
2832 Movers::const_iterator end = theMovers().end();
2834 for (; it != end; ++it) {
2835 Movers::const_iterator const sysit =
2836 find_if(sysbegin, sysend, SameMover(*it));
2837 if (sysit == sysend) {
2838 string const & fmt = it->first;
2839 string const & command =
2840 it->second.command();
2842 os << "\\copier " << fmt
2843 << " \"" << escapeCommand(command) << "\"\n";
2849 // We don't actually delete SpecialisedMover(s) from the
2850 // map, just clear their 'command', so there's no need
2851 // to test for anything else.
2858 void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new)
2860 // Why the switch you might ask. It is a trick to ensure that all
2861 // the elements in the LyXRCTags enum is handled. As you can see
2862 // there are no breaks at all. So it is just a huge fall-through.
2863 // The nice thing is that we will get a warning from the compiler
2864 // if we forget an element.
2865 LyXRC::LyXRCTags tag = LyXRC::RC_LAST;
2867 case LyXRC::RC_LAST:
2868 case LyXRC::RC_ACCEPT_COMPOUND:
2869 if (lyxrc_orig.spellchecker_accept_compound != lyxrc_new.spellchecker_accept_compound)
2870 if (theSpellChecker()) theSpellChecker()->advanceChangeNumber();
2872 case LyXRC::RC_ALT_LANG:
2873 case LyXRC::RC_PLAINTEXT_LINELEN:
2874 case LyXRC::RC_AUTOCORRECTION_MATH:
2875 case LyXRC::RC_AUTOREGIONDELETE:
2876 case LyXRC::RC_AUTORESET_OPTIONS:
2877 case LyXRC::RC_AUTOSAVE:
2878 case LyXRC::RC_AUTO_NUMBER:
2879 case LyXRC::RC_BACKUPDIR_PATH:
2880 case LyXRC::RC_BIBTEX_ALTERNATIVES:
2881 case LyXRC::RC_BIBTEX_COMMAND:
2882 case LyXRC::RC_BINDFILE:
2883 case LyXRC::RC_CHECKLASTFILES:
2884 case LyXRC::RC_COMPLETION_CURSOR_TEXT:
2885 case LyXRC::RC_COMPLETION_INLINE_DELAY:
2886 case LyXRC::RC_COMPLETION_INLINE_DOTS:
2887 case LyXRC::RC_COMPLETION_INLINE_MATH:
2888 case LyXRC::RC_COMPLETION_INLINE_TEXT:
2889 case LyXRC::RC_COMPLETION_POPUP_AFTER_COMPLETE:
2890 case LyXRC::RC_COMPLETION_POPUP_DELAY:
2891 case LyXRC::RC_COMPLETION_POPUP_MATH:
2892 case LyXRC::RC_COMPLETION_POPUP_TEXT:
2893 case LyXRC::RC_COMPLETION_MINLENGTH:
2894 case LyXRC::RC_USELASTFILEPOS:
2895 case LyXRC::RC_LOADSESSION:
2896 case LyXRC::RC_CHKTEX_COMMAND:
2897 case LyXRC::RC_CONVERTER:
2898 case LyXRC::RC_CONVERTER_CACHE_MAXAGE:
2899 case LyXRC::RC_COPIER:
2900 case LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR:
2901 case LyXRC::RC_SCROLL_BELOW_DOCUMENT:
2902 case LyXRC::RC_GUI_LANGUAGE:
2903 case LyXRC::RC_DEFAULT_OTF_VIEW_FORMAT:
2904 case LyXRC::RC_DEFAULT_PLATEX_VIEW_FORMAT:
2905 case LyXRC::RC_DEFAULT_VIEW_FORMAT:
2906 case LyXRC::RC_DEFFILE:
2907 case LyXRC::RC_DIALOGS_ICONIFY_WITH_MAIN:
2908 case LyXRC::RC_DISPLAY_GRAPHICS:
2909 case LyXRC::RC_DOCUMENTPATH:
2910 if (lyxrc_orig.document_path != lyxrc_new.document_path) {
2911 FileName path(lyxrc_new.document_path);
2912 if (path.exists() && path.isDirectory())
2913 package().document_dir() = FileName(lyxrc.document_path);
2916 case LyXRC::RC_EDITOR_ALTERNATIVES:
2917 case LyXRC::RC_ESC_CHARS:
2918 case LyXRC::RC_EXAMPLEPATH:
2919 case LyXRC::RC_FILEFORMAT:
2920 case LyXRC::RC_GROUP_LAYOUTS:
2921 case LyXRC::RC_HUNSPELLDIR_PATH:
2922 case LyXRC::RC_ICON_SET:
2923 case LyXRC::RC_INDEX_ALTERNATIVES:
2924 case LyXRC::RC_INDEX_COMMAND:
2925 case LyXRC::RC_JBIBTEX_COMMAND:
2926 case LyXRC::RC_JBIBTEX_ALTERNATIVES:
2927 case LyXRC::RC_JINDEX_COMMAND:
2928 case LyXRC::RC_NOMENCL_COMMAND:
2929 case LyXRC::RC_PYGMENTIZE_COMMAND:
2930 case LyXRC::RC_INPUT:
2931 case LyXRC::RC_KBMAP:
2932 case LyXRC::RC_KBMAP_PRIMARY:
2933 case LyXRC::RC_KBMAP_SECONDARY:
2934 case LyXRC::RC_LANGUAGE_AUTO_BEGIN:
2935 case LyXRC::RC_LANGUAGE_AUTO_END:
2936 case LyXRC::RC_LANGUAGE_COMMAND_BEGIN:
2937 case LyXRC::RC_LANGUAGE_COMMAND_END:
2938 case LyXRC::RC_LANGUAGE_COMMAND_LOCAL:
2939 case LyXRC::RC_LANGUAGE_GLOBAL_OPTIONS:
2940 case LyXRC::RC_LANGUAGE_CUSTOM_PACKAGE:
2941 case LyXRC::RC_LANGUAGE_PACKAGE_SELECTION:
2942 case LyXRC::RC_LYXRCFORMAT:
2943 case LyXRC::RC_MAC_DONTSWAP_CTRL_META:
2944 case LyXRC::RC_MAC_LIKE_CURSOR_MOVEMENT:
2945 case LyXRC::RC_MACRO_EDIT_STYLE:
2946 case LyXRC::RC_MAKE_BACKUP:
2947 case LyXRC::RC_MARK_FOREIGN_LANGUAGE:
2948 case LyXRC::RC_MOUSE_WHEEL_SPEED:
2949 case LyXRC::RC_MOUSE_MIDDLEBUTTON_PASTE:
2950 case LyXRC::RC_NUMLASTFILES:
2951 case LyXRC::RC_PARAGRAPH_MARKERS:
2952 case LyXRC::RC_PATH_PREFIX:
2953 if (lyxrc_orig.path_prefix != lyxrc_new.path_prefix) {
2954 prependEnvPath("PATH", lyxrc_new.path_prefix);
2955 // Resets python path
2956 support::os::python(true);
2959 case LyXRC::RC_PREVIEW:
2960 case LyXRC::RC_PREVIEW_HASHED_LABELS:
2961 case LyXRC::RC_PREVIEW_SCALE_FACTOR:
2962 case LyXRC::RC_PRINTLANDSCAPEFLAG:
2963 case LyXRC::RC_PRINTPAPERDIMENSIONFLAG:
2964 case LyXRC::RC_PRINTPAPERFLAG:
2965 case LyXRC::RC_SAVE_COMPRESSED:
2966 case LyXRC::RC_SAVE_ORIGIN:
2967 case LyXRC::RC_SCREEN_DPI:
2968 case LyXRC::RC_SCREEN_FONT_ROMAN:
2969 case LyXRC::RC_SCREEN_FONT_ROMAN_FOUNDRY:
2970 case LyXRC::RC_SCREEN_FONT_SANS:
2971 case LyXRC::RC_SCREEN_FONT_SANS_FOUNDRY:
2972 case LyXRC::RC_SCREEN_FONT_SCALABLE:
2973 case LyXRC::RC_SCREEN_FONT_SIZES:
2974 case LyXRC::RC_SCREEN_FONT_TYPEWRITER:
2975 case LyXRC::RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
2976 case LyXRC::RC_GEOMETRY_SESSION:
2977 case LyXRC::RC_SCREEN_ZOOM:
2978 case LyXRC::RC_SERVERPIPE:
2979 case LyXRC::RC_SET_COLOR:
2980 case LyXRC::RC_SHOW_BANNER:
2981 case LyXRC::RC_OPEN_BUFFERS_IN_TABS:
2982 case LyXRC::RC_SPELLCHECKER:
2983 if (lyxrc_orig.spellchecker != lyxrc_new.spellchecker)
2986 case LyXRC::RC_SPELLCHECK_CONTINUOUSLY:
2987 case LyXRC::RC_SPELLCHECK_NOTES:
2988 case LyXRC::RC_SPLITINDEX_COMMAND:
2989 case LyXRC::RC_TEMPDIRPATH:
2990 case LyXRC::RC_TEMPLATEPATH:
2991 case LyXRC::RC_TEX_ALLOWS_SPACES:
2992 case LyXRC::RC_TEX_EXPECTS_WINDOWS_PATHS:
2993 if (lyxrc_orig.windows_style_tex_paths != lyxrc_new.windows_style_tex_paths) {
2994 os::windows_style_tex_paths(lyxrc_new.windows_style_tex_paths);
2997 case LyXRC::RC_TEXINPUTS_PREFIX:
2998 case LyXRC::RC_THESAURUSDIRPATH:
2999 case LyXRC::RC_UIFILE:
3000 case LyXRC::RC_USER_EMAIL:
3001 case LyXRC::RC_USER_NAME:
3002 case LyXRC::RC_USE_CONVERTER_CACHE:
3003 case LyXRC::RC_USE_CONVERTER_NEEDAUTH_FORBIDDEN:
3004 case LyXRC::RC_USE_CONVERTER_NEEDAUTH:
3005 case LyXRC::RC_USE_NATIVE_FILEDIALOG:
3006 case LyXRC::RC_USE_SYSTEM_COLORS:
3007 case LyXRC::RC_USE_TOOLTIP:
3008 case LyXRC::RC_USE_PIXMAP_CACHE:
3009 case LyXRC::RC_USE_SYSTEM_THEME_ICONS:
3010 case LyXRC::RC_VIEWDVI_PAPEROPTION:
3011 case LyXRC::RC_SINGLE_CLOSE_TAB_BUTTON:
3012 case LyXRC::RC_SINGLE_INSTANCE:
3013 case LyXRC::RC_SORT_LAYOUTS:
3014 case LyXRC::RC_FULL_SCREEN_LIMIT:
3015 case LyXRC::RC_FULL_SCREEN_SCROLLBAR:
3016 case LyXRC::RC_FULL_SCREEN_MENUBAR:
3017 case LyXRC::RC_FULL_SCREEN_STATUSBAR:
3018 case LyXRC::RC_FULL_SCREEN_TABBAR:
3019 case LyXRC::RC_FULL_SCREEN_TOOLBARS:
3020 case LyXRC::RC_FULL_SCREEN_WIDTH:
3021 case LyXRC::RC_VISUAL_CURSOR:
3022 case LyXRC::RC_CLOSE_BUFFER_WITH_LAST_VIEW:
3023 case LyXRC::RC_VIEWER:
3024 case LyXRC::RC_VIEWER_ALTERNATIVES:
3025 case LyXRC::RC_FORWARD_SEARCH_DVI:
3026 case LyXRC::RC_FORWARD_SEARCH_PDF:
3027 case LyXRC::RC_EXPORT_OVERWRITE:
3028 case LyXRC::RC_DEFAULT_DECIMAL_POINT:
3029 case LyXRC::RC_DEFAULT_LENGTH_UNIT:
3030 case LyXRC::RC_SCROLL_WHEEL_ZOOM:
3031 case LyXRC::RC_CURSOR_WIDTH:
3037 set<string> LyXRC::getRCs()
3040 for (int i = 0; i != lyxrcCount; ++i)
3041 res.insert(ltrim(lyxrcTags[i].tag, "\\"));
3047 string const LyXRC::getDescription(LyXRCTags tag)
3052 case RC_ACCEPT_COMPOUND:
3053 str = _("Consider run-together words, such as \"diskdrive\" for \"disk drive\", as legal words?");
3057 str = _("Specify an alternate language. The default is to use the language of the document.");
3060 case RC_PLAINTEXT_LINELEN:
3061 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.");
3064 case RC_AUTOREGIONDELETE:
3065 str = _("De-select if you don't want the current selection to be replaced automatically by what you type.");
3068 case RC_AUTORESET_OPTIONS:
3069 str = _("De-select if you don't want the class options to be reset to defaults after class change.");
3073 str = _("The time interval between auto-saves (in seconds). 0 means no auto-save.");
3076 case RC_AUTO_NUMBER:
3079 case RC_BACKUPDIR_PATH:
3080 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.");
3083 case RC_BIBTEX_COMMAND:
3084 str = _("Define the options of bibtex (cf. man bibtex) or select an alternative compiler (e.g. mlbibtex or bibulus).");
3087 case RC_JBIBTEX_COMMAND:
3088 str = _("Define the options of the bibtex program for PLaTeX (Japanese LaTeX).");
3092 str = _("Keybindings file. Can either specify an absolute path, or LyX will look in its global and local bind/ directories.");
3095 case RC_CHECKLASTFILES:
3096 str = _("Select to check whether the lastfiles still exist.");
3099 case RC_CHKTEX_COMMAND:
3100 str = _("Define how to run chktex. E.g. \"chktex -n11 -n1 -n3 -n6 -n9 -22 -n25 -n30 -n38\" Refer to the ChkTeX documentation.");
3106 case RC_CONVERTER_NEEDAUTH_FORBIDDEN:
3107 str = _("Forbid use of external converters with 'needauth' option to prevent undesired effects.");
3110 case RC_CONVERTER_NEEDAUTH:
3111 str = _("Ask user before calling external converters with 'needauth' option to prevent undesired effects.");
3117 case RC_CURSOR_FOLLOWS_SCROLLBAR:
3118 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.");
3121 case RC_CURSOR_WIDTH:
3122 str = _("Configure the width of the text cursor. Automatic zoom-controlled cursor width used when set to 0.");
3125 case RC_SCROLL_BELOW_DOCUMENT:
3126 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");
3129 case RC_MAC_DONTSWAP_CTRL_META:
3130 str = _("Make Apple key act as Meta and Control key as Ctrl.");
3133 case RC_MAC_LIKE_CURSOR_MOVEMENT:
3134 str = _("Use the Mac OS X conventions for cursor movement");
3137 case RC_SHOW_MACRO_LABEL:
3138 str = _("Show a small box around a Math Macro with the macro name when the cursor is inside.");
3142 str = _("Command definition file. Can either specify an absolute path, or LyX will look in its global and local commands/ directories.");
3145 case RC_DEFAULT_OTF_VIEW_FORMAT:
3146 str = _("The default format used with LFUN_BUFFER_[VIEW|UPDATE] with non-TeX fonts.");
3149 case RC_DEFAULT_VIEW_FORMAT:
3150 str = _("The default format used with LFUN_BUFFER_[VIEW|UPDATE].");
3153 case RC_DIALOGS_ICONIFY_WITH_MAIN:
3154 str = _("Iconify the dialogs when the main window is iconified. (Affects only dialogs shown after the change has been made.)");
3157 case RC_DISPLAY_GRAPHICS:
3158 str = _("Select how LyX will display any graphics.");
3161 case RC_DOCUMENTPATH:
3162 str = _("The default path for your documents. An empty value selects the directory LyX was started from.");
3166 str = _("Specify additional chars that can be part of a word.");
3169 case RC_EXAMPLEPATH:
3170 str = _("The path that LyX will set when offering to choose an example. An empty value selects the directory LyX was started from.");
3176 case RC_INDEX_COMMAND:
3177 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\".");
3180 case RC_JINDEX_COMMAND:
3181 str = _("Define the options of the index program for PLaTeX (Japanese LaTeX).");
3184 case RC_NOMENCL_COMMAND:
3185 str = _("Define the options of makeindex (cf. man makeindex) to be used for nomenclatures. This might differ from the index processing options.");
3188 case RC_PYGMENTIZE_COMMAND:
3189 str = _("The command to run the python pygments syntax highlighter.");
3196 case RC_KBMAP_PRIMARY:
3197 case RC_KBMAP_SECONDARY:
3198 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.");
3201 case RC_LANGUAGE_AUTO_BEGIN:
3202 str = _("Select if a language switching command is needed at the beginning of the document.");
3205 case RC_LANGUAGE_AUTO_END:
3206 str = _("Select if a language switching command is needed at the end of the document.");
3209 case RC_LANGUAGE_COMMAND_BEGIN:
3210 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.");
3213 case RC_LANGUAGE_COMMAND_END:
3214 str = _("The LaTeX command for changing back to the language of the document.");
3217 case RC_LANGUAGE_COMMAND_LOCAL:
3218 str = _("The LaTeX command for local changing of the language.");
3221 case RC_LANGUAGE_GLOBAL_OPTIONS:
3222 str = _("De-select if you don't want the language(s) used as an argument to \\documentclass.");
3225 case RC_LANGUAGE_CUSTOM_PACKAGE:
3226 str = _("The LaTeX command for loading the language package. E.g. \"\\usepackage{babel}\", \"\\usepackage{omega}\".");
3229 case RC_LANGUAGE_PACKAGE_SELECTION:
3230 str = _("De-select if you don't want babel to be used when the language of the document is the default language.");
3233 case RC_USELASTFILEPOS:
3234 str = _("De-select if you do not want LyX to scroll to saved position.");
3237 case RC_LOADSESSION:
3238 str = _("De-select to prevent loading files opened from the last LyX session.");
3241 case RC_MAKE_BACKUP:
3242 str = _("De-select if you don't want LyX to create backup files.");
3245 case RC_MARK_FOREIGN_LANGUAGE:
3246 str = _("Select to control the highlighting of words with a language foreign to that of the document.");
3249 case RC_MOUSE_WHEEL_SPEED:
3250 str = _("The scrolling speed of the mouse wheel.");
3253 case RC_COMPLETION_POPUP_DELAY:
3254 str = _("The completion popup delay.");
3257 case RC_COMPLETION_POPUP_MATH:
3258 str = _("Select to display the completion popup in math mode.");
3261 case RC_COMPLETION_POPUP_TEXT:
3262 str = _("Select to display the completion popup in text mode.");
3265 case RC_COMPLETION_POPUP_AFTER_COMPLETE:
3266 str = _("Show the completion popup without delay after non-unique completion attempt.");
3269 case RC_COMPLETION_POPUP_TEXT:
3270 str = _("Show a small triangle on the cursor to indicate that a completion is available.");
3273 case RC_COMPLETION_POPUP_DELAY:
3274 str = _("The inline completion delay.");
3277 case RC_COMPLETION_INLINE_MATH:
3278 str = _("Select to display the inline completion in math mode.");
3281 case RC_COMPLETION_INLINE_TEXT:
3282 str = _("Select to display the inline completion in text mode.");
3285 case RC_COMPLETION_INLINE_DOTS:
3286 str = _("Use \"...\" to shorten long completions.");
3289 case RC_AUTOCORRECTION_MATH:
3290 str = _("Allow TeXMacs shorthand, like => converting to \\Rightarrow.");
3293 case RC_NUMLASTFILES:
3294 str = bformat(_("Maximal number of lastfiles. Up to %1$d can appear in the file menu."),
3298 case RC_PATH_PREFIX:
3299 str = _("Specify those directories which should be "
3300 "prepended to the PATH environment variable.\n"
3301 "Use the OS native format.");
3305 str = _("Shows a typeset preview of things such as math");
3308 case RC_PREVIEW_HASHED_LABELS:
3309 str = _("Previewed equations will have \"(#)\" labels rather than numbered ones");
3312 case RC_PREVIEW_SCALE_FACTOR:
3313 str = _("Scale the preview size to suit.");
3316 case RC_PRINTLANDSCAPEFLAG:
3317 str = _("The option to print out in landscape.");
3320 case RC_PRINTPAPERDIMENSIONFLAG:
3321 str = _("Option to specify the dimensions of the print paper.");
3324 case RC_PRINTPAPERFLAG:
3325 str = _("The option to specify paper type.");
3328 case RC_VISUAL_CURSOR:
3329 str = _("Select to have visual bidi cursor movement, unselect for logical movement.");
3332 case RC_CLOSE_BUFFER_WITH_LAST_VIEW:
3333 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).");
3337 str = _("DPI (dots per inch) of your monitor is auto-detected by LyX. If that goes wrong, override the setting here.");
3340 case RC_SCREEN_FONT_ROMAN:
3341 case RC_SCREEN_FONT_SANS:
3342 case RC_SCREEN_FONT_TYPEWRITER:
3343 str = _("The screen fonts used to display the text while editing.");
3346 case RC_SCREEN_FONT_ROMAN_FOUNDRY:
3347 case RC_SCREEN_FONT_SANS_FOUNDRY:
3348 case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
3351 case RC_SCREEN_FONT_SCALABLE:
3352 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.");
3355 case RC_SCREEN_FONT_SIZES:
3356 str = _("The font sizes used for calculating the scaling of the screen fonts.");
3359 case RC_SCREEN_ZOOM:
3360 //xgettext:no-c-format
3361 str = _("The zoom percentage for screen fonts. A setting of 100% will make the fonts roughly the same size as on paper.");
3364 case RC_GEOMETRY_SESSION:
3365 str = _("Allow session manager to save and restore windows geometry.");
3369 str = _("This starts the lyxserver. The pipes get an additional extension \".in\" and \".out\". Only for advanced users.");
3375 case RC_SHOW_BANNER:
3376 str = _("De-select if you don't want the startup banner.");
3379 case RC_TEMPDIRPATH:
3380 str = _("LyX will place its temporary directories in this path. They will be deleted when you quit LyX.");
3383 case RC_THESAURUSDIRPATH:
3384 str = _("This is the place where the files of the thesaurus library reside.");
3387 case RC_TEMPLATEPATH:
3388 str = _("The path that LyX will set when offering to choose a template. An empty value selects the directory LyX was started from.");
3391 case RC_TEX_ALLOWS_SPACES:
3394 case RC_TEX_EXPECTS_WINDOWS_PATHS:
3397 case RC_TEXINPUTS_PREFIX:
3398 str = _("Specify those directories which should be "
3399 "prepended to the TEXINPUTS environment variable.\n"
3400 "A '.' represents the current document directory. "
3401 "Use the OS native format.");
3405 str = _("The UI (user interface) file. Can either specify an absolute path, or LyX will look in its global and local ui/ directories.");
3414 case RC_USE_USE_SYSTEM_COLORS:
3415 str = _("Enable use the system colors for some things like main window background and selection.");
3418 case RC_USE_TOOLTIP:
3419 str = _("Enable the automatic appearance of tool tips in the work area.");
3422 case RC_USE_PIXMAP_CACHE:
3423 str = _("Enable the pixmap cache that might improve performance on Mac and Windows.");
3426 case RC_VIEWDVI_PAPEROPTION:
3427 _("Specify the paper command to DVI viewer (leave empty or use \"-paper\")");
3442 // The global instance
3445 // The global copy of the system lyxrc entries (everything except preferences)