3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
6 * \author Lars Gullik Bjønnes
7 * \author Jean-Marc Lasgouttes
8 * \author Angus Leeming
10 * \author André Pönitz
14 * Full author contact details are available in file CREDITS.
22 #include "Converter.h"
23 #include "FontEnums.h"
30 #include "graphics/GraphicsTypes.h"
32 #include "support/convert.h"
33 #include "support/debug.h"
34 #include "support/environment.h"
35 #include "support/filetools.h"
36 #include "support/gettext.h"
37 #include "support/lstrings.h"
38 #include "support/os.h"
39 #include "support/userinfo.h"
45 using namespace lyx::support;
49 namespace os = support::os;
53 // when adding something to this array keep it sorted!
54 LexerKeyword lyxrcTags[] = {
55 { "\\accept_compound", LyXRC::RC_ACCEPT_COMPOUND },
56 { "\\allow_geometry_session", LyXRC::RC_GEOMETRY_SESSION },
57 { "\\alternate_language", LyXRC::RC_ALT_LANG },
58 { "\\auto_number", LyXRC::RC_AUTO_NUMBER },
59 { "\\auto_region_delete", LyXRC::RC_AUTOREGIONDELETE },
60 { "\\auto_reset_options", LyXRC::RC_AUTORESET_OPTIONS },
61 { "\\autocorrection_math", LyXRC::RC_AUTOCORRECTION_MATH },
62 { "\\autosave", LyXRC::RC_AUTOSAVE },
63 { "\\backupdir_path", LyXRC::RC_BACKUPDIR_PATH },
64 { "\\bibtex_alternatives", LyXRC::RC_BIBTEX_ALTERNATIVES },
65 { "\\bibtex_command", LyXRC::RC_BIBTEX_COMMAND },
66 { "\\bind_file", LyXRC::RC_BINDFILE },
67 { "\\check_lastfiles", LyXRC::RC_CHECKLASTFILES },
68 { "\\chktex_command", LyXRC::RC_CHKTEX_COMMAND },
69 { "\\completion_cursor_text", LyXRC::RC_COMPLETION_CURSOR_TEXT },
70 { "\\completion_inline_delay", LyXRC::RC_COMPLETION_INLINE_DELAY },
71 { "\\completion_inline_dots", LyXRC::RC_COMPLETION_INLINE_DOTS },
72 { "\\completion_inline_math", LyXRC::RC_COMPLETION_INLINE_MATH },
73 { "\\completion_inline_text", LyXRC::RC_COMPLETION_INLINE_TEXT },
74 { "\\completion_popup_after_complete", LyXRC::RC_COMPLETION_POPUP_AFTER_COMPLETE },
75 { "\\completion_popup_delay", LyXRC::RC_COMPLETION_POPUP_DELAY },
76 { "\\completion_popup_math", LyXRC::RC_COMPLETION_POPUP_MATH },
77 { "\\completion_popup_text", LyXRC::RC_COMPLETION_POPUP_TEXT },
78 { "\\converter", LyXRC::RC_CONVERTER },
79 { "\\converter_cache_maxage", LyXRC::RC_CONVERTER_CACHE_MAXAGE },
80 { "\\copier", LyXRC::RC_COPIER },
81 { "\\cursor_follows_scrollbar", LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR },
82 { "\\date_insert_format", LyXRC::RC_DATE_INSERT_FORMAT },
83 { "\\def_file", LyXRC::RC_DEFFILE },
84 { "\\default_language", LyXRC::RC_DEFAULT_LANGUAGE },
85 { "\\default_papersize", LyXRC::RC_DEFAULT_PAPERSIZE },
86 { "\\default_view_format", LyXRC::RC_DEFAULT_VIEW_FORMAT },
87 { "\\dialogs_iconify_with_main", LyXRC::RC_DIALOGS_ICONIFY_WITH_MAIN },
88 { "\\display_graphics", LyXRC::RC_DISPLAY_GRAPHICS },
89 { "\\document_path", LyXRC::RC_DOCUMENTPATH },
90 { "\\editor_alternatives", LyXRC::RC_EDITOR_ALTERNATIVES },
91 { "\\escape_chars", LyXRC::RC_ESC_CHARS },
92 { "\\example_path", LyXRC::RC_EXAMPLEPATH },
93 { "\\font_encoding", LyXRC::RC_FONT_ENCODING },
94 { "\\format", LyXRC::RC_FORMAT },
95 { "\\fullscreen_limit", LyXRC::RC_FULL_SCREEN_LIMIT },
96 { "\\fullscreen_menubar", LyXRC::RC_FULL_SCREEN_MENUBAR },
97 { "\\fullscreen_scrollbar", LyXRC::RC_FULL_SCREEN_SCROLLBAR },
98 { "\\fullscreen_tabbar", LyXRC::RC_FULL_SCREEN_TABBAR },
99 { "\\fullscreen_toolbars", LyXRC::RC_FULL_SCREEN_TOOLBARS },
100 { "\\fullscreen_width", LyXRC::RC_FULL_SCREEN_WIDTH },
101 { "\\group_layouts", LyXRC::RC_GROUP_LAYOUTS },
102 { "\\gui_language", LyXRC::RC_GUI_LANGUAGE },
103 { "\\hunspelldir_path", LyXRC::RC_HUNSPELLDIR_PATH },
104 { "\\index_alternatives", LyXRC::RC_INDEX_ALTERNATIVES },
105 { "\\index_command", LyXRC::RC_INDEX_COMMAND },
106 { "\\input", LyXRC::RC_INPUT },
107 { "\\jbibtex_command", LyXRC::RC_JBIBTEX_COMMAND },
108 { "\\jindex_command", LyXRC::RC_JINDEX_COMMAND },
109 { "\\kbmap", LyXRC::RC_KBMAP },
110 { "\\kbmap_primary", LyXRC::RC_KBMAP_PRIMARY },
111 { "\\kbmap_secondary", LyXRC::RC_KBMAP_SECONDARY },
112 { "\\label_init_length", LyXRC::RC_LABEL_INIT_LENGTH },
113 { "\\language_auto_begin", LyXRC::RC_LANGUAGE_AUTO_BEGIN },
114 { "\\language_auto_end", LyXRC::RC_LANGUAGE_AUTO_END },
115 { "\\language_command_begin", LyXRC::RC_LANGUAGE_COMMAND_BEGIN },
116 { "\\language_command_end", LyXRC::RC_LANGUAGE_COMMAND_END },
117 { "\\language_command_local", LyXRC::RC_LANGUAGE_COMMAND_LOCAL },
118 { "\\language_global_options", LyXRC::RC_LANGUAGE_GLOBAL_OPTIONS },
119 { "\\language_package", LyXRC::RC_LANGUAGE_PACKAGE },
120 { "\\language_use_babel", LyXRC::RC_LANGUAGE_USE_BABEL },
121 { "\\load_session", LyXRC::RC_LOADSESSION },
122 { "\\mac_like_word_movement", LyXRC::RC_MAC_LIKE_WORD_MOVEMENT },
123 { "\\macro_edit_style", LyXRC::RC_MACRO_EDIT_STYLE },
124 { "\\make_backup", LyXRC::RC_MAKE_BACKUP },
125 { "\\mark_foreign_language", LyXRC::RC_MARK_FOREIGN_LANGUAGE },
126 { "\\mouse_wheel_speed", LyXRC::RC_MOUSE_WHEEL_SPEED },
127 { "\\nomencl_command", LyXRC::RC_NOMENCL_COMMAND },
128 { "\\num_lastfiles", LyXRC::RC_NUMLASTFILES },
129 { "\\open_buffers_in_tabs", LyXRC::RC_OPEN_BUFFERS_IN_TABS },
130 { "\\paragraph_markers", LyXRC::RC_PARAGRAPH_MARKERS },
131 { "\\path_prefix", LyXRC::RC_PATH_PREFIX },
132 { "\\personal_dictionary", LyXRC::RC_PERS_DICT },
133 { "\\plaintext_linelen", LyXRC::RC_PLAINTEXT_LINELEN },
134 { "\\plaintext_roff_command", LyXRC::RC_PLAINTEXT_ROFF_COMMAND },
135 { "\\preview", LyXRC::RC_PREVIEW },
136 { "\\preview_hashed_labels", LyXRC::RC_PREVIEW_HASHED_LABELS },
137 { "\\preview_scale_factor", LyXRC::RC_PREVIEW_SCALE_FACTOR },
138 { "\\print_adapt_output", LyXRC::RC_PRINT_ADAPTOUTPUT },
139 { "\\print_collcopies_flag", LyXRC::RC_PRINTCOLLCOPIESFLAG },
140 { "\\print_command", LyXRC::RC_PRINT_COMMAND },
141 { "\\print_copies_flag", LyXRC::RC_PRINTCOPIESFLAG },
142 { "\\print_evenpage_flag", LyXRC::RC_PRINTEVENPAGEFLAG },
143 { "\\print_extra_options", LyXRC::RC_PRINTEXSTRAOPTIONS },
144 { "\\print_file_extension", LyXRC::RC_PRINTFILEEXTENSION },
145 { "\\print_landscape_flag", LyXRC::RC_PRINTLANDSCAPEFLAG },
146 { "\\print_oddpage_flag", LyXRC::RC_PRINTODDPAGEFLAG },
147 { "\\print_pagerange_flag", LyXRC::RC_PRINTPAGERANGEFLAG },
148 { "\\print_paper_dimension_flag", LyXRC::RC_PRINTPAPERDIMENSIONFLAG },
149 { "\\print_paper_flag", LyXRC::RC_PRINTPAPERFLAG },
150 { "\\print_reverse_flag", LyXRC::RC_PRINTREVERSEFLAG },
151 { "\\print_spool_command", LyXRC::RC_PRINTSPOOL_COMMAND },
152 { "\\print_spool_printerprefix", LyXRC::RC_PRINTSPOOL_PRINTERPREFIX },
153 { "\\print_to_file", LyXRC::RC_PRINTTOFILE },
154 { "\\print_to_printer", LyXRC::RC_PRINTTOPRINTER },
155 { "\\printer", LyXRC::RC_PRINTER },
156 { "\\rtl", LyXRC::RC_RTL_SUPPORT },
157 { "\\screen_dpi", LyXRC::RC_SCREEN_DPI },
158 { "\\screen_font_roman", LyXRC::RC_SCREEN_FONT_ROMAN },
159 { "\\screen_font_roman_foundry", LyXRC::RC_SCREEN_FONT_ROMAN_FOUNDRY },
160 { "\\screen_font_sans", LyXRC::RC_SCREEN_FONT_SANS },
161 { "\\screen_font_sans_foundry", LyXRC::RC_SCREEN_FONT_SANS_FOUNDRY },
162 { "\\screen_font_scalable", LyXRC::RC_SCREEN_FONT_SCALABLE },
163 { "\\screen_font_sizes", LyXRC::RC_SCREEN_FONT_SIZES },
164 { "\\screen_font_typewriter", LyXRC::RC_SCREEN_FONT_TYPEWRITER },
165 { "\\screen_font_typewriter_foundry", LyXRC::RC_SCREEN_FONT_TYPEWRITER_FOUNDRY },
166 { "\\screen_zoom", LyXRC::RC_SCREEN_ZOOM },
167 { "\\scroll_below_document", LyXRC::RC_SCROLL_BELOW_DOCUMENT },
168 { "\\serverpipe", LyXRC::RC_SERVERPIPE },
169 { "\\set_color", LyXRC::RC_SET_COLOR },
170 { "\\show_banner", LyXRC::RC_SHOW_BANNER },
171 { "\\sort_layouts", LyXRC::RC_SORT_LAYOUTS },
172 { "\\spell_command", LyXRC::RC_SPELL_COMMAND },
173 { "\\spellcheck_continuously", LyXRC::RC_SPELLCHECK_CONTINUOUSLY },
174 { "\\spellchecker", LyXRC::RC_SPELLCHECKER },
175 { "\\splitindex_command", LyXRC::RC_SPLITINDEX_COMMAND },
176 { "\\tempdir_path", LyXRC::RC_TEMPDIRPATH },
177 { "\\template_path", LyXRC::RC_TEMPLATEPATH },
178 { "\\tex_allows_spaces", LyXRC::RC_TEX_ALLOWS_SPACES },
179 { "\\tex_expects_windows_paths", LyXRC::RC_TEX_EXPECTS_WINDOWS_PATHS },
180 { "\\thesaurusdir_path", LyXRC::RC_THESAURUSDIRPATH },
181 { "\\ui_file", LyXRC::RC_UIFILE },
182 { "\\use_alt_language", LyXRC::RC_USE_ALT_LANG },
183 { "\\use_converter_cache", LyXRC::RC_USE_CONVERTER_CACHE },
184 { "\\use_escape_chars", LyXRC::RC_USE_ESC_CHARS },
185 { "\\use_input_encoding", LyXRC::RC_USE_INP_ENC },
186 { "\\use_lastfilepos", LyXRC::RC_USELASTFILEPOS },
187 { "\\use_personal_dictionary", LyXRC::RC_USE_PERS_DICT },
188 { "\\use_pixmap_cache", LyXRC::RC_USE_PIXMAP_CACHE },
189 // compatibility with versions older than 1.4.0 only
190 { "\\use_pspell", LyXRC::RC_USE_SPELL_LIB },
191 // compatibility with versions older than 1.4.0 only
192 { "\\use_tempdir", LyXRC::RC_USETEMPDIR },
193 { "\\use_tooltip", LyXRC::RC_USE_TOOLTIP },
194 { "\\user_email", LyXRC::RC_USER_EMAIL },
195 { "\\user_name", LyXRC::RC_USER_NAME },
196 { "\\view_dvi_paper_option", LyXRC::RC_VIEWDVI_PAPEROPTION },
197 // compatibility with versions older than 1.4.0 only
198 { "\\viewer", LyXRC::RC_VIEWER},
199 { "\\viewer_alternatives", LyXRC::RC_VIEWER_ALTERNATIVES },
200 { "\\visual_cursor" ,LyXRC::RC_VISUAL_CURSOR}
203 const int lyxrcCount = sizeof(lyxrcTags) / sizeof(lyxrcTags[0]);
214 void LyXRC::setDefaults()
217 def_file = "default";
219 // Get printer from the environment. If fail, use default "",
220 // assuming that everything is set up correctly.
221 printer = getEnv("PRINTER");
222 print_adapt_output = false;
223 print_command = "dvips";
224 print_evenpage_flag = "-B";
225 print_oddpage_flag = "-A";
226 print_pagerange_flag = "-pp";
227 print_copies_flag = "-c";
228 print_collcopies_flag = "-C";
229 print_reverse_flag = "-r";
230 print_landscape_flag = "-t landscape";
231 print_to_printer = "-P";
232 print_to_file = "-o ";
233 print_file_extension = ".ps";
234 print_paper_flag = "-t";
235 print_paper_dimension_flag = "-T";
236 document_path.erase();
237 view_dvi_paper_option.erase();
238 default_papersize = PAPER_DEFAULT;
239 default_view_format = "pdf2";
240 chktex_command = "chktex -n1 -n3 -n6 -n9 -n22 -n25 -n30 -n38";
241 bibtex_command = "bibtex";
243 index_command = "makeindex -c -q";
244 nomencl_command = "makeindex -s nomencl.ist";
246 // Because a screen typically is wider than a piece of paper:
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;
269 num_lastfiles = maxlastfiles;
270 check_lastfiles = true;
271 use_lastfilepos = true;
272 load_session = false;
274 backupdir_path.erase();
275 display_graphics = true;
276 // Spellchecker settings:
277 spellchecker = "aspell";
278 spellchecker_accept_compound = false;
279 spellcheck_continuously = false;
282 visual_cursor = false;
284 mark_foreign_language = true;
285 language_auto_begin = true;
286 language_auto_end = true;
287 language_global_options = true;
288 language_use_babel = true;
289 language_package = "\\usepackage{babel}";
290 language_command_begin = "\\selectlanguage{$$lang}";
291 language_command_local = "\\foreignlanguage{$$lang}{";
292 sort_layouts = false;
293 group_layouts = true;
294 default_language = "english";
295 gui_language = "auto";
297 windows_style_tex_paths = false;
298 tex_allows_spaces = false;
299 date_insert_format = "%x";
300 cursor_follows_scrollbar = false;
301 scroll_below_document = false;
302 paragraph_markers = false;
303 mac_like_word_movement = false;
304 macro_edit_style = MACRO_EDIT_INLINE_BOX;
305 dialogs_iconify_with_main = false;
306 label_init_length = 3;
307 preview = PREVIEW_OFF;
308 preview_hashed_labels = false;
309 preview_scale_factor = "0.9";
310 use_converter_cache = true;
312 use_pixmap_cache = false;
313 converter_cache_maxage = 6 * 30 * 24 * 3600; // 6 months
314 user_name = to_utf8(support::user_name());
315 user_email = to_utf8(support::user_email());
316 open_buffers_in_tabs = true;
318 // Fullscreen settings
319 full_screen_limit = false;
320 full_screen_toolbars = true;
321 full_screen_tabbar = true;
322 full_screen_menubar = true;
323 full_screen_scrollbar = true;
324 full_screen_width = 700;
326 completion_cursor_text = true;
327 completion_popup_math = true;
328 completion_popup_text = false;
329 completion_popup_delay = 2.0;
330 completion_popup_after_complete = true;
331 autocorrection_math = false;
332 completion_inline_math = true;
333 completion_inline_text = false;
334 completion_inline_dots = -1;
335 completion_inline_delay = 0.2;
341 void oldFontFormat(string & family, string & foundry)
343 if (family.empty() || family[0] != '-')
345 foundry = token(family, '-', 1);
346 family = token(family, '-', 2);
354 int LyXRC::read(FileName const & filename)
356 Lexer lexrc(lyxrcTags);
357 if (lyxerr.debugging(Debug::PARSER))
358 lexrc.printTable(lyxerr);
360 lexrc.setFile(filename);
364 LYXERR(Debug::LYXRC, "Reading '" << filename << "'...");
370 int LyXRC::read(istream & is)
372 Lexer lexrc(lyxrcTags);
373 if (lyxerr.debugging(Debug::PARSER))
374 lexrc.printTable(lyxerr);
380 LYXERR(Debug::LYXRC, "Reading istream...");
386 int LyXRC::read(Lexer & lexrc)
391 while (lexrc.isOK()) {
392 // By using two switches we take advantage of the compiler
393 // telling us if we have missed a LyXRCTags element in
394 // the second switch.
395 // Note that this also shows a problem with Lexer since it
396 // helps us avoid taking advantage of the strictness of the
399 int le = lexrc.lex();
401 case Lexer::LEX_UNDEF:
402 lexrc.printError("Unknown tag `$$Token'");
404 case Lexer::LEX_FEOF:
409 switch (static_cast<LyXRCTags>(le)) {
410 case RC_INPUT: // Include file
413 libFileSearch(string(),
416 lexrc.printError("Error reading "
417 "included file: " + tmp.absFilename());
423 bind_file = os::internal_path(lexrc.getString());
428 def_file = os::internal_path(lexrc.getString());
433 ui_file = os::internal_path(lexrc.getString());
436 case RC_AUTORESET_OPTIONS:
437 lexrc >> auto_reset_options;
440 case RC_DISPLAY_GRAPHICS:
442 display_graphics = lexrc.getString() == "true";
445 case RC_TEX_EXPECTS_WINDOWS_PATHS:
446 lexrc >> windows_style_tex_paths;
449 case RC_TEX_ALLOWS_SPACES:
450 lexrc >> tex_allows_spaces;
457 case RC_KBMAP_PRIMARY:
459 string const kmap(os::internal_path(lexrc.getString()));
460 if (!libFileSearch("kbd", kmap, "kmap").empty()
462 primary_kbmap = kmap;
464 lexrc.printError("LyX: Keymap `$$Token' not found");
469 case RC_KBMAP_SECONDARY:
471 string const kmap(os::internal_path(lexrc.getString()));
472 if (!libFileSearch("kbd", kmap, "kmap").empty()
474 secondary_kbmap = kmap;
476 lexrc.printError("LyX: Keymap `$$Token' not found");
481 case RC_FONT_ENCODING:
489 case RC_PRINT_COMMAND:
490 if (lexrc.next(true)) {
491 print_command = lexrc.getString();
495 case RC_PRINTEVENPAGEFLAG:
496 lexrc >> print_evenpage_flag;
499 case RC_PRINTODDPAGEFLAG:
500 lexrc >> print_oddpage_flag;
503 case RC_PRINTPAGERANGEFLAG:
504 lexrc >> print_pagerange_flag;
507 case RC_PRINTCOPIESFLAG:
508 lexrc >> print_copies_flag;
511 case RC_PRINTCOLLCOPIESFLAG:
512 lexrc >> print_collcopies_flag;
515 case RC_PRINTREVERSEFLAG:
516 lexrc >> print_reverse_flag;
519 case RC_PRINTLANDSCAPEFLAG:
520 lexrc >> print_landscape_flag;
523 case RC_PRINTTOPRINTER:
524 lexrc >> print_to_printer;
527 case RC_PRINT_ADAPTOUTPUT:
528 lexrc >> print_adapt_output;
533 print_to_file = os::internal_path(lexrc.getString());
537 case RC_PRINTFILEEXTENSION:
538 lexrc >> print_file_extension;
541 case RC_PRINTEXSTRAOPTIONS:
542 lexrc >> print_extra_options;
545 case RC_PRINTSPOOL_COMMAND:
546 if (lexrc.next(true)) {
547 print_spool_command = lexrc.getString();
551 case RC_PRINTSPOOL_PRINTERPREFIX:
552 lexrc >> print_spool_printerprefix;
555 case RC_PRINTPAPERDIMENSIONFLAG:
556 lexrc >> print_paper_dimension_flag;
559 case RC_PRINTPAPERFLAG:
560 lexrc >> print_paper_flag;
563 case RC_DEFAULT_PAPERSIZE:
565 string const size = ascii_lowercase(lexrc.getString());
566 if (size == "usletter")
567 default_papersize = PAPER_USLETTER;
568 else if (size == "legal")
569 default_papersize = PAPER_USLEGAL;
570 else if (size == "executive")
571 default_papersize = PAPER_USEXECUTIVE;
572 else if (size == "a3")
573 default_papersize = PAPER_A3;
574 else if (size == "a4")
575 default_papersize = PAPER_A4;
576 else if (size == "a5")
577 default_papersize = PAPER_A5;
578 else if (size == "b5")
579 default_papersize = PAPER_B5;
580 else if (size == "default")
581 default_papersize = PAPER_DEFAULT;
585 case RC_VIEWDVI_PAPEROPTION:
587 view_dvi_paper_option = lexrc.getString();
589 view_dvi_paper_option.erase();
592 case RC_CHKTEX_COMMAND:
593 if (lexrc.next(true)) {
594 chktex_command = lexrc.getString();
598 case RC_BIBTEX_ALTERNATIVES:
599 if (lexrc.next(true)) {
600 bibtex_alternatives.insert(lexrc.getString());
604 case RC_BIBTEX_COMMAND:
605 if (lexrc.next(true)) {
606 bibtex_command = lexrc.getString();
610 case RC_JBIBTEX_COMMAND:
611 if (lexrc.next(true)) {
612 jbibtex_command = lexrc.getString();
616 case RC_INDEX_ALTERNATIVES:
617 if (lexrc.next(true)) {
618 index_alternatives.insert(lexrc.getString());
622 case RC_INDEX_COMMAND:
623 if (lexrc.next(true)) {
624 index_command = lexrc.getString();
628 case RC_JINDEX_COMMAND:
629 if (lexrc.next(true)) {
630 jindex_command = lexrc.getString();
634 case RC_SPLITINDEX_COMMAND:
635 if (lexrc.next(true)) {
636 splitindex_command = lexrc.getString();
640 case RC_NOMENCL_COMMAND:
641 if (lexrc.next(true)) {
642 nomencl_command = lexrc.getString();
654 case RC_GEOMETRY_SESSION:
655 lexrc >> allow_geometry_session;
658 case RC_SCREEN_FONT_SIZES:
659 lexrc >> font_sizes[FONT_SIZE_TINY];
660 lexrc >> font_sizes[FONT_SIZE_SCRIPT];
661 lexrc >> font_sizes[FONT_SIZE_FOOTNOTE];
662 lexrc >> font_sizes[FONT_SIZE_SMALL];
663 lexrc >> font_sizes[FONT_SIZE_NORMAL];
664 lexrc >> font_sizes[FONT_SIZE_LARGE];
665 lexrc >> font_sizes[FONT_SIZE_LARGER];
666 lexrc >> font_sizes[FONT_SIZE_LARGEST];
667 lexrc >> font_sizes[FONT_SIZE_HUGE];
668 lexrc >> font_sizes[FONT_SIZE_HUGER];
671 case RC_SCREEN_FONT_SCALABLE:
672 lexrc >> use_scalable_fonts;
679 case RC_DOCUMENTPATH:
681 document_path = os::internal_path(lexrc.getString());
682 document_path = expandPath(document_path);
688 example_path = os::internal_path(lexrc.getString());
689 example_path = expandPath(example_path);
693 case RC_TEMPLATEPATH:
695 template_path = os::internal_path(lexrc.getString());
696 template_path = expandPath(template_path);
702 tempdir_path = os::internal_path(lexrc.getString());
703 tempdir_path = expandPath(tempdir_path);
707 case RC_THESAURUSDIRPATH:
709 thesaurusdir_path = os::internal_path(lexrc.getString());
710 thesaurusdir_path = expandPath(thesaurusdir_path);
714 case RC_HUNSPELLDIR_PATH:
716 hunspelldir_path = os::internal_path(lexrc.getString());
717 hunspelldir_path = expandPath(hunspelldir_path);
721 case RC_USELASTFILEPOS:
722 lexrc >> use_lastfilepos;
726 lexrc >> load_session;
729 case RC_MOUSE_WHEEL_SPEED:
730 lexrc >> mouse_wheel_speed;
733 case RC_COMPLETION_INLINE_DELAY:
734 lexrc >> completion_inline_delay;
737 case RC_COMPLETION_INLINE_MATH:
738 lexrc >> completion_inline_math;
741 case RC_COMPLETION_INLINE_TEXT:
742 lexrc >> completion_inline_text;
745 case RC_COMPLETION_INLINE_DOTS:
746 lexrc >> completion_inline_dots;
749 case RC_AUTOCORRECTION_MATH:
750 lexrc >> autocorrection_math;
753 case RC_COMPLETION_POPUP_DELAY:
754 lexrc >> completion_popup_delay;
757 case RC_COMPLETION_POPUP_MATH:
758 lexrc >> completion_popup_math;
761 case RC_COMPLETION_POPUP_TEXT:
762 lexrc >> completion_popup_text;
765 case RC_COMPLETION_CURSOR_TEXT:
766 lexrc >> completion_cursor_text;
769 case RC_COMPLETION_POPUP_AFTER_COMPLETE:
770 lexrc >> completion_popup_after_complete;
773 case RC_NUMLASTFILES:
774 lexrc >> num_lastfiles;
777 case RC_CHECKLASTFILES:
778 lexrc >> check_lastfiles;
781 case RC_SCREEN_FONT_ROMAN:
783 roman_font_name = lexrc.getString();
784 oldFontFormat(roman_font_name,
789 case RC_SCREEN_FONT_SANS:
791 sans_font_name = lexrc.getString();
792 oldFontFormat(sans_font_name, sans_font_foundry);
796 case RC_SCREEN_FONT_TYPEWRITER:
798 typewriter_font_name = lexrc.getString();
799 oldFontFormat(typewriter_font_name,
800 typewriter_font_foundry);
804 case RC_SCREEN_FONT_ROMAN_FOUNDRY:
805 lexrc >> roman_font_foundry;
808 case RC_SCREEN_FONT_SANS_FOUNDRY:
809 lexrc >> sans_font_foundry;
812 case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
813 lexrc >> typewriter_font_foundry;
818 lexrc.printError("Missing color tag.");
821 string lyx_name = lexrc.getString();
824 lexrc.printError("Missing color name for color: `$$Token'");
827 string x11_name = lexrc.getString();
829 ColorCode const col =
830 lcolor.getFromLyXName(lyx_name);
831 if (col == Color_none ||
832 col == Color_inherit ||
836 if (!lcolor.setColor(col, x11_name))
837 LYXERR0("Bad lyxrc set_color for " << lyx_name);
841 case RC_AUTOREGIONDELETE:
842 // Auto region delete defaults to true
843 lexrc >> auto_region_delete;
848 lyxpipes = os::internal_path(lexrc.getString());
849 lyxpipes = expandPath(lyxpipes);
853 case RC_CURSOR_FOLLOWS_SCROLLBAR:
854 lexrc >> cursor_follows_scrollbar;
857 case RC_SCROLL_BELOW_DOCUMENT:
858 lexrc >> scroll_below_document;
861 case RC_PARAGRAPH_MARKERS:
862 lexrc >> paragraph_markers;
865 case RC_MAC_LIKE_WORD_MOVEMENT:
866 lexrc >> mac_like_word_movement;
869 case RC_MACRO_EDIT_STYLE:
871 switch (lexrc.getInteger()) {
872 case 0: macro_edit_style = MACRO_EDIT_INLINE_BOX; break;
873 case 1: macro_edit_style = MACRO_EDIT_INLINE; break;
874 case 2: macro_edit_style = MACRO_EDIT_LIST; break;
879 case RC_DIALOGS_ICONIFY_WITH_MAIN:
880 lexrc >> dialogs_iconify_with_main;
883 case RC_PLAINTEXT_LINELEN:
884 lexrc >> plaintext_linelen;
886 // Spellchecker settings:
887 case RC_ACCEPT_COMPOUND:
888 lexrc >> spellchecker_accept_compound;
891 lexrc >> use_tooltip;
893 case RC_USE_PIXMAP_CACHE:
894 lexrc >> use_pixmap_cache;
896 case RC_SPELLCHECKER:
897 lexrc >> spellchecker;
900 lexrc >> spellchecker_alt_lang;
903 lexrc >> spellchecker_esc_chars;
905 case RC_SPELLCHECK_CONTINUOUSLY:
906 lexrc >> spellcheck_continuously;
909 lexrc >> make_backup;
911 case RC_BACKUPDIR_PATH:
913 backupdir_path = os::internal_path(lexrc.getString());
914 backupdir_path = expandPath(backupdir_path);
917 case RC_DATE_INSERT_FORMAT:
918 lexrc >> date_insert_format;
920 case RC_LANGUAGE_PACKAGE:
921 lexrc >> language_package;
923 case RC_LANGUAGE_AUTO_BEGIN:
924 lexrc >> language_auto_begin;
926 case RC_LANGUAGE_AUTO_END:
927 lexrc >> language_auto_end;
929 case RC_LANGUAGE_GLOBAL_OPTIONS:
930 lexrc >> language_global_options;
932 case RC_LANGUAGE_USE_BABEL:
933 lexrc >> language_use_babel;
935 case RC_LANGUAGE_COMMAND_BEGIN:
936 lexrc >> language_command_begin;
938 case RC_LANGUAGE_COMMAND_END:
939 lexrc >> language_command_end;
941 case RC_LANGUAGE_COMMAND_LOCAL:
942 lexrc >> language_command_local;
945 lexrc >> rtl_support;
947 case RC_VISUAL_CURSOR:
948 lexrc >> visual_cursor;
951 lexrc >> auto_number;
953 case RC_MARK_FOREIGN_LANGUAGE:
954 lexrc >> mark_foreign_language;
960 fmt = lexrc.getString();
961 if (lexrc.next(true))
962 command = lexrc.getString();
963 setMover(fmt, command);
968 string from, to, command, flags;
970 from = lexrc.getString();
972 to = lexrc.getString();
973 if (lexrc.next(true))
974 command = lexrc.getString();
976 flags = lexrc.getString();
978 theConverters().erase(from, to);
980 theConverters().add(from, to, command, flags);
983 // compatibility with versions older than 1.4.0 only
985 string format, command;
986 lexrc >> format >> command;
987 formats.setViewer(format, command);
991 string format, extension, prettyname, shortcut;
992 lexrc >> format >> extension >> prettyname >> shortcut;
993 string viewer, editor;
994 if (lexrc.next(true))
995 viewer = lexrc.getString();
996 if (lexrc.next(true))
997 editor = lexrc.getString();
999 // Hack to ensure compatibility with versions older
1001 int le = lexrc.lex();
1002 if (le != Lexer::LEX_FEOF && le != Lexer::LEX_UNDEF) {
1003 flags = lexrc.getString();
1004 if (le != Lexer::LEX_DATA) {
1005 // We have got a known token.
1006 // Therefore this is an old style
1007 // format definition without
1009 lexrc.pushToken(flags);
1013 int flgs = Format::none;
1014 while (!flags.empty()) {
1016 flags = split(flags, flag, ',');
1017 if (flag == "document")
1018 flgs |= Format::document;
1019 else if (flag == "vector")
1020 flgs |= Format::vector;
1022 LYXERR0("Ignoring unknown flag `"
1023 << flag << "' for format `"
1026 if (prettyname.empty()) {
1027 if (theConverters().formatIsUsed(format))
1028 LYXERR0("Can't delete format " << format);
1030 formats.erase(format);
1032 formats.add(format, extension, prettyname,
1033 shortcut, viewer, editor, flgs);
1037 case RC_VIEWER_ALTERNATIVES: {
1038 string format, command;
1039 lexrc >> format >> command;
1040 viewer_alternatives.push_back(make_pair(format, command));
1043 case RC_EDITOR_ALTERNATIVES: {
1044 string format, command;
1045 lexrc >> format >> command;
1046 editor_alternatives.push_back(make_pair(format, command));
1050 case RC_DEFAULT_VIEW_FORMAT:
1051 lexrc >> default_view_format;
1054 case RC_DEFAULT_LANGUAGE:
1055 lexrc >> default_language;
1058 case RC_GUI_LANGUAGE:
1059 lexrc >> gui_language;
1062 case RC_LABEL_INIT_LENGTH:
1063 lexrc >> label_init_length;
1066 case RC_SHOW_BANNER:
1067 lexrc >> show_banner;
1072 string const tmp = lexrc.getString();
1073 if (tmp == "true" || tmp == "on")
1074 preview = PREVIEW_ON;
1075 else if (tmp == "no_math")
1076 preview = PREVIEW_NO_MATH;
1078 preview = PREVIEW_OFF;
1079 if (tmp != "false" && tmp != "off")
1080 LYXERR0("Unrecognized preview status \""
1086 case RC_PREVIEW_HASHED_LABELS:
1087 lexrc >> preview_hashed_labels;
1090 case RC_PREVIEW_SCALE_FACTOR:
1091 lexrc >> preview_scale_factor;
1098 lexrc >> user_email;
1101 case RC_PATH_PREFIX:
1102 lexrc >> path_prefix;
1105 case RC_USE_CONVERTER_CACHE:
1106 lexrc >> use_converter_cache;
1108 case RC_CONVERTER_CACHE_MAXAGE:
1109 lexrc >> converter_cache_maxage;
1112 case RC_SORT_LAYOUTS:
1113 lexrc >> sort_layouts;
1115 case RC_GROUP_LAYOUTS:
1116 lexrc >> group_layouts;
1118 case RC_FULL_SCREEN_LIMIT:
1119 lexrc >> full_screen_limit;
1121 case RC_FULL_SCREEN_TOOLBARS:
1122 lexrc >> full_screen_toolbars;
1124 case RC_FULL_SCREEN_SCROLLBAR:
1125 lexrc >> full_screen_scrollbar;
1127 case RC_FULL_SCREEN_TABBAR:
1128 lexrc >> full_screen_tabbar;
1130 case RC_FULL_SCREEN_MENUBAR:
1131 lexrc >> full_screen_menubar;
1133 case RC_FULL_SCREEN_WIDTH:
1134 lexrc >> full_screen_width;
1136 case RC_OPEN_BUFFERS_IN_TABS:
1137 lexrc >> open_buffers_in_tabs;
1140 // Obsoteted in 1.4.0
1143 case RC_SPELL_COMMAND:
1145 case RC_PLAINTEXT_ROFF_COMMAND:
1146 case RC_USE_ALT_LANG:
1147 case RC_USE_ESC_CHARS:
1148 case RC_USE_INP_ENC:
1149 case RC_USE_PERS_DICT:
1150 case RC_USE_SPELL_LIB:
1151 LYXERR(Debug::LYXRC, "Skipping obsolete tag `"
1152 << lexrc.getString() << "'.");
1157 break; // this is just a dummy
1161 /// Update converters data-structures
1162 theConverters().update(formats);
1163 theConverters().buildGraph();
1169 void LyXRC::write(FileName const & filename, bool ignore_system_lyxrc) const
1171 ofstream ofs(filename.toFilesystemEncoding().c_str());
1173 write(ofs, ignore_system_lyxrc);
1177 void LyXRC::print() const
1179 if (lyxerr.debugging())
1180 write(lyxerr, false);
1188 typedef pair<string, SpecialisedMover> Data;
1190 SameMover(Data const & comparison)
1191 : comparison_(comparison) {}
1193 bool operator()(Data const & data) const
1195 return data.first == comparison_.first &&
1196 data.second.command() == comparison_.second.command();
1206 // Escape \ and " so that LyXLex can read the string later
1207 string escapeCommand(string const & str) {
1208 return subst(subst(str , "\\", "\\\\"),
1215 void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) const
1217 LyXRCTags tag = RC_LAST;
1219 if (!name.empty()) {
1220 for (int i = 0; i != lyxrcCount; ++i)
1221 if ("\\" + name == lyxrcTags[i].tag)
1222 tag = static_cast<LyXRCTags>(lyxrcTags[i].code);
1226 os << "# LyX " << lyx_version
1227 << " generated this file. If you want to make your own\n"
1228 << "# modifications you should do them from inside LyX and save.\n"
1231 // Why the switch you might ask. It is a trick to ensure that all
1232 // the elements in the LyXRCTags enum are handled. As you can see
1233 // there are no breaks at all. So it is just a huge fall-through.
1234 // The nice thing is that we will get a warning from the compiler
1235 // if we forget an element.
1239 // input/include files are not done here
1241 if (ignore_system_lyxrc ||
1242 bind_file != system_lyxrc.bind_file) {
1243 string const path = os::external_path(bind_file);
1244 os << "\\bind_file \"" << path << "\"\n";
1250 if (ignore_system_lyxrc ||
1251 def_file != system_lyxrc.def_file) {
1252 string const path = os::external_path(def_file);
1253 os << "\\def_file \"" << path << "\"\n";
1262 << "# MISC SECTION ######################################\n"
1264 // bind files are not done here.
1266 case RC_PATH_PREFIX:
1267 if (ignore_system_lyxrc ||
1268 path_prefix != system_lyxrc.path_prefix) {
1269 os << "\\path_prefix \"" << path_prefix << "\"\n";
1274 if (ignore_system_lyxrc ||
1275 ui_file != system_lyxrc.ui_file) {
1276 string const path = os::external_path(ui_file);
1277 os << "\\ui_file \"" << path << "\"\n";
1281 case RC_AUTOREGIONDELETE:
1282 if (ignore_system_lyxrc ||
1283 auto_region_delete != system_lyxrc.auto_region_delete) {
1284 os << "# Set to false to inhibit automatic replacement of\n"
1285 << "# the current selection.\n"
1286 << "\\auto_region_delete " << convert<string>(auto_region_delete)
1291 case RC_AUTORESET_OPTIONS:
1292 if (ignore_system_lyxrc ||
1293 auto_reset_options != system_lyxrc.auto_reset_options) {
1294 os << "# Set to false to inhibit automatic reset of\n"
1295 << "# the class options to defaults on class change.\n"
1296 << "\\auto_reset_options "
1297 << convert<string>(auto_reset_options)
1303 if (ignore_system_lyxrc ||
1304 autosave != system_lyxrc.autosave) {
1305 os << "# The time interval between auto-saves in seconds.\n"
1306 << "\\autosave " << autosave << '\n';
1310 case RC_DISPLAY_GRAPHICS:
1311 if (ignore_system_lyxrc ||
1312 display_graphics != system_lyxrc.display_graphics) {
1313 os << "# Display graphics within LyX\n"
1315 << "\\display_graphics "
1316 << (display_graphics ? "true" : "false")
1321 case RC_SORT_LAYOUTS:
1322 if (ignore_system_lyxrc ||
1323 sort_layouts != system_lyxrc.sort_layouts) {
1324 os << "# Sort layouts alphabetically.\n"
1325 << "\\sort_layouts " << convert<string>(sort_layouts) << '\n';
1329 case RC_GROUP_LAYOUTS:
1330 if (ignore_system_lyxrc ||
1331 group_layouts != system_lyxrc.group_layouts) {
1332 os << "# Group layouts by their category.\n"
1333 << "\\group_layouts " << convert<string>(group_layouts) << '\n';
1337 case RC_VIEWDVI_PAPEROPTION:
1338 if (ignore_system_lyxrc ||
1339 view_dvi_paper_option
1340 != system_lyxrc.view_dvi_paper_option) {
1341 os << "# Options used to specify paper size to the\n"
1342 << "# view_dvi_command (e.g. -paper)\n"
1343 << "\\view_dvi_paper_option \""
1344 << view_dvi_paper_option << "\"\n";
1348 case RC_DEFAULT_PAPERSIZE:
1349 if (ignore_system_lyxrc ||
1350 default_papersize != system_lyxrc.default_papersize) {
1351 os << "# The default papersize to use.\n"
1352 << "\\default_papersize \"";
1353 switch (default_papersize) {
1355 os << "default"; break;
1356 case PAPER_USLETTER:
1357 os << "usletter"; break;
1359 os << "legal"; break;
1360 case PAPER_USEXECUTIVE:
1361 os << "executive"; break;
1372 case PAPER_B4: break;
1378 case RC_CHKTEX_COMMAND:
1379 if (ignore_system_lyxrc ||
1380 chktex_command != system_lyxrc.chktex_command) {
1381 os << "\\chktex_command \"" << escapeCommand(chktex_command) << "\"\n";
1385 case RC_BIBTEX_ALTERNATIVES: {
1386 set<string>::const_iterator it = bibtex_alternatives.begin();
1387 set<string>::const_iterator end = bibtex_alternatives.end();
1388 for ( ; it != end; ++it) {
1389 if (ignore_system_lyxrc
1390 || !system_lyxrc.bibtex_alternatives.count(*it))
1391 os << "\\bibtex_alternatives \""
1397 case RC_BIBTEX_COMMAND:
1398 if (ignore_system_lyxrc ||
1399 bibtex_command != system_lyxrc.bibtex_command) {
1400 os << "\\bibtex_command \"" << escapeCommand(bibtex_command) << "\"\n";
1404 case RC_JBIBTEX_COMMAND:
1405 if (ignore_system_lyxrc ||
1406 jbibtex_command != system_lyxrc.jbibtex_command) {
1407 os << "\\jbibtex_command \"" << escapeCommand(jbibtex_command) << "\"\n";
1411 case RC_INDEX_ALTERNATIVES: {
1412 set<string>::const_iterator it = index_alternatives.begin();
1413 set<string>::const_iterator end = index_alternatives.end();
1414 for ( ; it != end; ++it) {
1415 if (ignore_system_lyxrc
1416 || !system_lyxrc.index_alternatives.count(*it))
1417 os << "\\index_alternatives \""
1423 case RC_INDEX_COMMAND:
1424 if (ignore_system_lyxrc ||
1425 index_command != system_lyxrc.index_command) {
1426 os << "\\index_command \"" << escapeCommand(index_command) << "\"\n";
1430 case RC_JINDEX_COMMAND:
1431 if (ignore_system_lyxrc ||
1432 jindex_command != system_lyxrc.jindex_command) {
1433 os << "\\jindex_command \"" << escapeCommand(jindex_command) << "\"\n";
1437 case RC_SPLITINDEX_COMMAND:
1438 if (ignore_system_lyxrc ||
1439 splitindex_command != system_lyxrc.splitindex_command) {
1440 os << "\\splitindex_command \"" << escapeCommand(splitindex_command) << "\"\n";
1444 case RC_NOMENCL_COMMAND:
1445 if (ignore_system_lyxrc ||
1446 nomencl_command != system_lyxrc.nomencl_command) {
1447 os << "\\nomencl_command \"" << escapeCommand(nomencl_command) << "\"\n";
1451 case RC_TEX_EXPECTS_WINDOWS_PATHS:
1452 if (ignore_system_lyxrc ||
1453 windows_style_tex_paths != system_lyxrc.windows_style_tex_paths) {
1454 os << "\\tex_expects_windows_paths "
1455 << convert<string>(windows_style_tex_paths) << '\n';
1459 case RC_TEX_ALLOWS_SPACES:
1460 if (tex_allows_spaces != system_lyxrc.tex_allows_spaces) {
1461 os << "\\tex_allows_spaces "
1462 << convert<string>(tex_allows_spaces) << '\n';
1467 if (ignore_system_lyxrc ||
1468 use_kbmap != system_lyxrc.use_kbmap) {
1469 os << "\\kbmap " << convert<string>(use_kbmap) << '\n';
1473 case RC_KBMAP_PRIMARY:
1474 if (ignore_system_lyxrc ||
1475 primary_kbmap != system_lyxrc.primary_kbmap) {
1476 string const path = os::external_path(primary_kbmap);
1477 os << "\\kbmap_primary \"" << path << "\"\n";
1481 case RC_KBMAP_SECONDARY:
1482 if (ignore_system_lyxrc ||
1483 secondary_kbmap != system_lyxrc.secondary_kbmap) {
1484 string const path = os::external_path(secondary_kbmap);
1485 os << "\\kbmap_secondary \"" << path << "\"\n";
1490 if (ignore_system_lyxrc ||
1491 lyxpipes != system_lyxrc.lyxpipes) {
1492 string const path = os::external_path(lyxpipes);
1493 os << "\\serverpipe \"" << path << "\"\n";
1497 case RC_DATE_INSERT_FORMAT:
1498 if (ignore_system_lyxrc ||
1499 date_insert_format != system_lyxrc.date_insert_format) {
1500 os << "\\date_insert_format \"" << date_insert_format
1505 case RC_LABEL_INIT_LENGTH:
1506 if (ignore_system_lyxrc ||
1507 label_init_length != system_lyxrc.label_init_length) {
1508 os << "\\label_init_length " << label_init_length
1515 os << "\\user_name \"" << user_name << "\"\n";
1520 os << "\\user_email \"" << user_email << "\"\n";
1524 case RC_SHOW_BANNER:
1525 if (ignore_system_lyxrc ||
1526 show_banner != system_lyxrc.show_banner) {
1527 os << "\\show_banner " << convert<string>(show_banner) << '\n';
1533 if (ignore_system_lyxrc ||
1534 preview != system_lyxrc.preview) {
1540 case PREVIEW_NO_MATH:
1547 os << "\\preview " << status << '\n';
1552 case RC_PREVIEW_HASHED_LABELS:
1553 if (ignore_system_lyxrc ||
1554 preview_hashed_labels !=
1555 system_lyxrc.preview_hashed_labels) {
1556 os << "\\preview_hashed_labels "
1557 << convert<string>(preview_hashed_labels) << '\n';
1562 case RC_PREVIEW_SCALE_FACTOR:
1563 if (ignore_system_lyxrc ||
1564 preview_scale_factor != system_lyxrc.preview_scale_factor) {
1565 os << "\\preview_scale_factor "
1566 << preview_scale_factor << '\n';
1571 case RC_USE_CONVERTER_CACHE:
1572 if (ignore_system_lyxrc ||
1573 use_converter_cache != system_lyxrc.use_converter_cache) {
1574 os << "\\use_converter_cache "
1575 << convert<string>(use_converter_cache) << '\n';
1580 case RC_CONVERTER_CACHE_MAXAGE:
1581 if (ignore_system_lyxrc ||
1582 converter_cache_maxage != system_lyxrc.converter_cache_maxage) {
1583 os << "\\converter_cache_maxage "
1584 << converter_cache_maxage << '\n';
1590 << "# SCREEN & FONTS SECTION ############################\n"
1594 if (ignore_system_lyxrc ||
1595 dpi != system_lyxrc.dpi) {
1596 os << "\\screen_dpi " << dpi << '\n';
1600 case RC_SCREEN_ZOOM:
1601 if (ignore_system_lyxrc ||
1602 zoom != system_lyxrc.zoom) {
1603 os << "\\screen_zoom " << zoom << '\n';
1607 case RC_GEOMETRY_SESSION:
1608 if (ignore_system_lyxrc ||
1609 allow_geometry_session != system_lyxrc.allow_geometry_session) {
1610 os << "\\allow_geometry_session " << convert<string>(allow_geometry_session)
1615 case RC_CURSOR_FOLLOWS_SCROLLBAR:
1616 if (ignore_system_lyxrc ||
1617 cursor_follows_scrollbar
1618 != system_lyxrc.cursor_follows_scrollbar) {
1619 os << "\\cursor_follows_scrollbar "
1620 << convert<string>(cursor_follows_scrollbar) << '\n';
1624 case RC_SCROLL_BELOW_DOCUMENT:
1625 if (ignore_system_lyxrc ||
1626 scroll_below_document
1627 != system_lyxrc.scroll_below_document) {
1628 os << "\\scroll_below_document "
1629 << convert<string>(scroll_below_document) << '\n';
1633 case RC_PARAGRAPH_MARKERS:
1634 if (ignore_system_lyxrc ||
1636 != system_lyxrc.paragraph_markers) {
1637 os << "\\paragraph_markers "
1638 << convert<string>(paragraph_markers) << '\n';
1642 case RC_MAC_LIKE_WORD_MOVEMENT:
1643 if (ignore_system_lyxrc ||
1644 mac_like_word_movement
1645 != system_lyxrc.mac_like_word_movement) {
1646 os << "\\mac_like_word_movement "
1647 << convert<string>(mac_like_word_movement) << '\n';
1651 case RC_MACRO_EDIT_STYLE:
1652 if (ignore_system_lyxrc ||
1654 != system_lyxrc.macro_edit_style) {
1655 os << "\\macro_edit_style ";
1656 switch (macro_edit_style) {
1657 case MACRO_EDIT_INLINE_BOX: os << "0\n"; break;
1658 case MACRO_EDIT_INLINE: os << "1\n"; break;
1659 case MACRO_EDIT_LIST: os << "2\n"; break;
1664 case RC_DIALOGS_ICONIFY_WITH_MAIN:
1665 if (ignore_system_lyxrc ||
1666 dialogs_iconify_with_main
1667 != system_lyxrc.dialogs_iconify_with_main) {
1668 os << "\\dialogs_iconify_with_main "
1669 << convert<string>(dialogs_iconify_with_main) << '\n';
1673 case RC_SCREEN_FONT_ROMAN:
1674 if (ignore_system_lyxrc ||
1675 roman_font_name != system_lyxrc.roman_font_name) {
1676 os << "\\screen_font_roman \"" << roman_font_name
1681 case RC_SCREEN_FONT_ROMAN_FOUNDRY:
1682 if (ignore_system_lyxrc ||
1683 roman_font_foundry != system_lyxrc.roman_font_foundry) {
1684 os << "\\screen_font_roman_foundry \"" << roman_font_foundry
1689 case RC_SCREEN_FONT_SANS:
1690 if (ignore_system_lyxrc ||
1691 sans_font_name != system_lyxrc.sans_font_name) {
1692 os << "\\screen_font_sans \"" << sans_font_name
1697 case RC_SCREEN_FONT_SANS_FOUNDRY:
1698 if (ignore_system_lyxrc ||
1699 sans_font_foundry != system_lyxrc.sans_font_foundry) {
1700 os << "\\screen_font_sans_foundry \"" << sans_font_foundry
1705 case RC_SCREEN_FONT_TYPEWRITER:
1706 if (ignore_system_lyxrc ||
1707 typewriter_font_name != system_lyxrc.typewriter_font_name) {
1708 os << "\\screen_font_typewriter \""
1709 << typewriter_font_name << "\"\n";
1713 case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
1714 if (ignore_system_lyxrc ||
1715 typewriter_font_foundry != system_lyxrc.typewriter_font_foundry) {
1716 os << "\\screen_font_typewriter_foundry \""
1717 << typewriter_font_foundry << "\"\n";
1722 case RC_SCREEN_FONT_SCALABLE:
1723 if (ignore_system_lyxrc ||
1724 use_scalable_fonts != system_lyxrc.use_scalable_fonts) {
1725 os << "\\screen_font_scalable "
1726 << convert<string>(use_scalable_fonts)
1731 case RC_SCREEN_FONT_SIZES:
1732 if (ignore_system_lyxrc ||
1733 font_sizes[FONT_SIZE_TINY]
1734 != system_lyxrc.font_sizes[FONT_SIZE_TINY] ||
1735 font_sizes[FONT_SIZE_SCRIPT]
1736 != system_lyxrc.font_sizes[FONT_SIZE_SCRIPT] ||
1737 font_sizes[FONT_SIZE_FOOTNOTE]
1738 != system_lyxrc.font_sizes[FONT_SIZE_FOOTNOTE] ||
1739 font_sizes[FONT_SIZE_SMALL]
1740 != system_lyxrc.font_sizes[FONT_SIZE_SMALL] ||
1741 font_sizes[FONT_SIZE_NORMAL]
1742 != system_lyxrc.font_sizes[FONT_SIZE_NORMAL] ||
1743 font_sizes[FONT_SIZE_LARGE]
1744 != system_lyxrc.font_sizes[FONT_SIZE_LARGE] ||
1745 font_sizes[FONT_SIZE_LARGER]
1746 != system_lyxrc.font_sizes[FONT_SIZE_LARGER] ||
1747 font_sizes[FONT_SIZE_LARGEST]
1748 != system_lyxrc.font_sizes[FONT_SIZE_LARGEST] ||
1749 font_sizes[FONT_SIZE_HUGE]
1750 != system_lyxrc.font_sizes[FONT_SIZE_HUGE] ||
1751 font_sizes[FONT_SIZE_HUGER]
1752 != system_lyxrc.font_sizes[FONT_SIZE_HUGER]) {
1753 os.setf(ios::fixed);
1755 os << "\\screen_font_sizes"
1756 << ' ' << font_sizes[FONT_SIZE_TINY]
1757 << ' ' << font_sizes[FONT_SIZE_SCRIPT]
1758 << ' ' << font_sizes[FONT_SIZE_FOOTNOTE]
1759 << ' ' << font_sizes[FONT_SIZE_SMALL]
1760 << ' ' << font_sizes[FONT_SIZE_NORMAL]
1761 << ' ' << font_sizes[FONT_SIZE_LARGE]
1762 << ' ' << font_sizes[FONT_SIZE_LARGER]
1763 << ' ' << font_sizes[FONT_SIZE_LARGEST]
1764 << ' ' << font_sizes[FONT_SIZE_HUGE]
1765 << ' ' << font_sizes[FONT_SIZE_HUGER]
1770 case RC_FULL_SCREEN_LIMIT:
1771 if (ignore_system_lyxrc ||
1772 full_screen_limit != system_lyxrc.full_screen_limit) {
1773 os << "\\fullscreen_limit "
1774 << convert<string>(full_screen_limit)
1779 case RC_FULL_SCREEN_TOOLBARS:
1780 if (ignore_system_lyxrc ||
1781 full_screen_toolbars != system_lyxrc.full_screen_toolbars) {
1782 os << "\\fullscreen_toolbars "
1783 << convert<string>(full_screen_toolbars)
1788 case RC_FULL_SCREEN_SCROLLBAR:
1789 if (ignore_system_lyxrc ||
1790 full_screen_scrollbar != system_lyxrc.full_screen_scrollbar) {
1791 os << "\\fullscreen_scrollbar "
1792 << convert<string>(full_screen_scrollbar)
1797 case RC_FULL_SCREEN_TABBAR:
1798 if (ignore_system_lyxrc ||
1799 full_screen_tabbar != system_lyxrc.full_screen_tabbar) {
1800 os << "\\fullscreen_tabbar "
1801 << convert<string>(full_screen_tabbar)
1806 case RC_FULL_SCREEN_MENUBAR:
1807 if (ignore_system_lyxrc ||
1808 full_screen_menubar != system_lyxrc.full_screen_menubar) {
1809 os << "\\fullscreen_menubar "
1810 << convert<string>(full_screen_menubar)
1815 case RC_FULL_SCREEN_WIDTH:
1816 if (ignore_system_lyxrc ||
1817 full_screen_width != system_lyxrc.full_screen_width) {
1818 os << "\\fullscreen_width "
1819 << convert<string>(full_screen_width)
1824 case RC_OPEN_BUFFERS_IN_TABS:
1825 if (ignore_system_lyxrc ||
1826 open_buffers_in_tabs != system_lyxrc.open_buffers_in_tabs) {
1827 os << "\\open_buffers_in_tabs "
1828 << convert<string>(open_buffers_in_tabs)
1835 << "# COLOR SECTION ###################################\n"
1839 for (int i = 0; i < Color_ignore; ++i) {
1840 ColorCode lc = static_cast<ColorCode>(i);
1841 string const col = lcolor.getX11Name(lc);
1842 if (ignore_system_lyxrc
1843 || col != system_lcolor.getX11Name(lc)) {
1844 os << "\\set_color \""
1845 << lcolor.getLyXName(lc) << "\" \""
1853 << "# PRINTER SECTION ###################################\n"
1857 if (ignore_system_lyxrc ||
1858 printer != system_lyxrc.printer) {
1859 os << "\\printer \"" << printer << "\"\n";
1863 case RC_PRINT_ADAPTOUTPUT:
1864 if (ignore_system_lyxrc ||
1865 print_adapt_output != system_lyxrc.print_adapt_output) {
1866 os << "\\print_adapt_output "
1867 << convert<string>(print_adapt_output)
1872 case RC_PRINT_COMMAND:
1873 if (ignore_system_lyxrc ||
1874 print_command != system_lyxrc.print_command) {
1875 os << "\\print_command \"" << escapeCommand(print_command) << "\"\n";
1879 case RC_PRINTEXSTRAOPTIONS:
1880 if (ignore_system_lyxrc ||
1881 print_extra_options != system_lyxrc.print_extra_options) {
1882 os << "\\print_extra_options \"" << print_extra_options
1887 case RC_PRINTSPOOL_COMMAND:
1888 if (ignore_system_lyxrc ||
1889 print_spool_command != system_lyxrc.print_spool_command) {
1890 os << "\\print_spool_command \"" << escapeCommand(print_spool_command)
1895 case RC_PRINTSPOOL_PRINTERPREFIX:
1896 if (ignore_system_lyxrc ||
1897 print_spool_printerprefix
1898 != system_lyxrc.print_spool_printerprefix) {
1899 os << "\\print_spool_printerprefix \""
1900 << print_spool_printerprefix << "\"\n";
1904 case RC_PRINTEVENPAGEFLAG:
1905 if (ignore_system_lyxrc ||
1906 print_evenpage_flag != system_lyxrc.print_evenpage_flag) {
1907 os << "\\print_evenpage_flag \"" << print_evenpage_flag
1912 case RC_PRINTODDPAGEFLAG:
1913 if (ignore_system_lyxrc ||
1914 print_oddpage_flag != system_lyxrc.print_oddpage_flag) {
1915 os << "\\print_oddpage_flag \"" << print_oddpage_flag
1920 case RC_PRINTREVERSEFLAG:
1921 if (ignore_system_lyxrc ||
1922 print_reverse_flag != system_lyxrc.print_reverse_flag) {
1923 os << "\\print_reverse_flag \"" << print_reverse_flag
1928 case RC_PRINTLANDSCAPEFLAG:
1929 if (ignore_system_lyxrc ||
1930 print_landscape_flag != system_lyxrc.print_landscape_flag) {
1931 os << "\\print_landscape_flag \"" << print_landscape_flag
1936 case RC_PRINTPAGERANGEFLAG:
1937 if (ignore_system_lyxrc ||
1938 print_pagerange_flag != system_lyxrc.print_pagerange_flag) {
1939 os << "\\print_pagerange_flag \"" << print_pagerange_flag
1944 case RC_PRINTCOPIESFLAG:
1945 if (ignore_system_lyxrc ||
1946 print_copies_flag != system_lyxrc.print_copies_flag) {
1947 os << "\\print_copies_flag \"" << print_copies_flag
1952 case RC_PRINTCOLLCOPIESFLAG:
1953 if (ignore_system_lyxrc ||
1954 print_collcopies_flag
1955 != system_lyxrc.print_collcopies_flag) {
1956 os << "\\print_collcopies_flag \""
1957 << print_collcopies_flag
1962 case RC_PRINTPAPERFLAG:
1963 if (ignore_system_lyxrc ||
1964 print_paper_flag != system_lyxrc.print_paper_flag) {
1965 os << "\\print_paper_flag \"" << print_paper_flag
1970 case RC_PRINTPAPERDIMENSIONFLAG:
1971 if (ignore_system_lyxrc ||
1972 print_paper_dimension_flag
1973 != system_lyxrc.print_paper_dimension_flag) {
1974 os << "\\print_paper_dimension_flag \""
1975 << print_paper_dimension_flag << "\"\n";
1979 case RC_PRINTTOPRINTER:
1980 if (ignore_system_lyxrc ||
1981 print_to_printer != system_lyxrc.print_to_printer) {
1982 os << "\\print_to_printer \"" << print_to_printer
1987 case RC_PRINTTOFILE:
1988 if (ignore_system_lyxrc ||
1989 print_to_file != system_lyxrc.print_to_file) {
1990 string const path = os::external_path(print_to_file);
1991 os << "\\print_to_file \"" << path << "\"\n";
1995 case RC_PRINTFILEEXTENSION:
1996 if (ignore_system_lyxrc ||
1997 print_file_extension != system_lyxrc.print_file_extension) {
1998 os << "\\print_file_extension \""
1999 << print_file_extension
2006 << "# TEX SECTION #######################################\n"
2009 case RC_FONT_ENCODING:
2010 if (ignore_system_lyxrc ||
2011 fontenc != system_lyxrc.fontenc) {
2012 os << "\\font_encoding \"" << fontenc << "\"\n";
2018 << "# FILE SECTION ######################################\n"
2021 case RC_DOCUMENTPATH:
2022 if (ignore_system_lyxrc ||
2023 document_path != system_lyxrc.document_path) {
2024 string const path = os::external_path(document_path);
2025 os << "\\document_path \"" << path << "\"\n";
2029 case RC_USELASTFILEPOS:
2030 if (ignore_system_lyxrc ||
2031 use_lastfilepos != system_lyxrc.use_lastfilepos) {
2032 os << "\\use_lastfilepos " << convert<string>(use_lastfilepos)
2037 case RC_LOADSESSION:
2038 if (ignore_system_lyxrc ||
2039 load_session != system_lyxrc.load_session) {
2040 os << "\\load_session " << convert<string>(load_session)
2045 case RC_MOUSE_WHEEL_SPEED:
2046 if (ignore_system_lyxrc ||
2047 mouse_wheel_speed != system_lyxrc.mouse_wheel_speed) {
2048 os << "\\mouse_wheel_speed " << mouse_wheel_speed << '\n';
2052 case RC_COMPLETION_INLINE_DELAY:
2053 if (ignore_system_lyxrc ||
2054 completion_inline_delay != system_lyxrc.completion_inline_delay) {
2055 os << "\\completion_inline_delay " << completion_inline_delay << '\n';
2059 case RC_COMPLETION_INLINE_MATH:
2060 if (ignore_system_lyxrc ||
2061 completion_inline_math != system_lyxrc.completion_inline_math) {
2062 os << "\\completion_inline_math "
2063 << convert<string>(completion_inline_math) << '\n';
2067 case RC_COMPLETION_INLINE_TEXT:
2068 if (ignore_system_lyxrc ||
2069 completion_inline_text != system_lyxrc.completion_inline_text) {
2070 os << "\\completion_inline_text "
2071 << convert<string>(completion_inline_text) << '\n';
2075 case RC_COMPLETION_INLINE_DOTS:
2076 if (ignore_system_lyxrc ||
2077 completion_inline_dots != system_lyxrc.completion_inline_dots) {
2078 os << "\\completion_inline_dots "
2079 << convert<string>(completion_inline_dots) << '\n';
2083 case RC_AUTOCORRECTION_MATH:
2084 if (ignore_system_lyxrc ||
2085 autocorrection_math != system_lyxrc.autocorrection_math) {
2086 os << "\\autocorrection_math "
2087 << convert<string>(autocorrection_math) << '\n';
2091 case RC_COMPLETION_POPUP_DELAY:
2092 if (ignore_system_lyxrc ||
2093 completion_popup_delay != system_lyxrc.completion_popup_delay) {
2094 os << "\\completion_popup_delay " << completion_popup_delay << '\n';
2098 case RC_COMPLETION_POPUP_MATH:
2099 if (ignore_system_lyxrc ||
2100 completion_popup_math != system_lyxrc.completion_popup_math) {
2101 os << "\\completion_popup_math "
2102 << convert<string>(completion_popup_math) << '\n';
2106 case RC_COMPLETION_POPUP_TEXT:
2107 if (ignore_system_lyxrc ||
2108 completion_popup_text != system_lyxrc.completion_popup_text) {
2109 os << "\\completion_popup_text "
2110 << convert<string>(completion_popup_text) << '\n';
2114 case RC_COMPLETION_CURSOR_TEXT:
2115 if (ignore_system_lyxrc ||
2116 completion_cursor_text != system_lyxrc.completion_cursor_text) {
2117 os << "\\completion_cursor_text "
2118 << convert<string>(completion_cursor_text) << '\n';
2122 case RC_COMPLETION_POPUP_AFTER_COMPLETE:
2123 if (ignore_system_lyxrc ||
2124 completion_popup_after_complete
2125 != system_lyxrc.completion_popup_after_complete) {
2126 os << "\\completion_popup_after_complete "
2127 << convert<string>(completion_popup_after_complete) << '\n';
2131 case RC_NUMLASTFILES:
2132 if (ignore_system_lyxrc ||
2133 num_lastfiles != system_lyxrc.num_lastfiles) {
2134 os << "\\num_lastfiles " << num_lastfiles << '\n';
2138 case RC_CHECKLASTFILES:
2139 if (ignore_system_lyxrc ||
2140 check_lastfiles != system_lyxrc.check_lastfiles) {
2141 os << "\\check_lastfiles " << convert<string>(check_lastfiles)
2146 case RC_EXAMPLEPATH:
2147 if (ignore_system_lyxrc ||
2148 example_path != system_lyxrc.example_path) {
2149 string const path = os::external_path(example_path);
2150 os << "\\example_path \"" << path << "\"\n";
2154 case RC_TEMPLATEPATH:
2155 if (ignore_system_lyxrc ||
2156 template_path != system_lyxrc.template_path) {
2157 string const path = os::external_path(template_path);
2158 os << "\\template_path \"" << path << "\"\n";
2162 case RC_TEMPDIRPATH:
2163 if (ignore_system_lyxrc ||
2164 tempdir_path != system_lyxrc.tempdir_path) {
2165 string const path = os::external_path(tempdir_path);
2166 os << "\\tempdir_path \"" << path << "\"\n";
2170 case RC_THESAURUSDIRPATH:
2171 if (ignore_system_lyxrc ||
2172 thesaurusdir_path != system_lyxrc.thesaurusdir_path) {
2173 string const path = os::external_path(thesaurusdir_path);
2174 os << "\\thesaurusdir_path \"" << path << "\"\n";
2178 case RC_HUNSPELLDIR_PATH:
2179 if (ignore_system_lyxrc ||
2180 hunspelldir_path != system_lyxrc.hunspelldir_path) {
2181 string const path = os::external_path(hunspelldir_path);
2182 os << "\\hunspelldir_path \"" << path << "\"\n";
2190 case RC_PLAINTEXT_ROFF_COMMAND: // Obsoleted in 2.0
2193 case RC_PLAINTEXT_LINELEN:
2194 if (ignore_system_lyxrc ||
2195 plaintext_linelen != system_lyxrc.plaintext_linelen) {
2196 os << "\\plaintext_linelen " << plaintext_linelen << '\n';
2200 case RC_MAKE_BACKUP:
2201 if (ignore_system_lyxrc ||
2202 make_backup != system_lyxrc.make_backup) {
2203 os << "\\make_backup " << convert<string>(make_backup) << '\n';
2207 case RC_BACKUPDIR_PATH:
2208 if (ignore_system_lyxrc ||
2209 backupdir_path != system_lyxrc.backupdir_path) {
2210 string const path = os::external_path(backupdir_path);
2211 os << "\\backupdir_path \"" << path << "\"\n";
2217 << "# PLAIN TEXT EXPORT SECTION ##############################\n"
2221 << "# SPELLCHECKER SECTION ##############################\n"
2224 case RC_SPELL_COMMAND:
2225 case RC_USE_SPELL_LIB:
2229 case RC_ACCEPT_COMPOUND:
2230 if (ignore_system_lyxrc ||
2231 spellchecker_accept_compound != system_lyxrc.spellchecker_accept_compound) {
2232 os << "\\accept_compound " << convert<string>(spellchecker_accept_compound)
2237 case RC_USE_ALT_LANG:
2242 if (ignore_system_lyxrc ||
2243 spellchecker_alt_lang != system_lyxrc.spellchecker_alt_lang) {
2244 os << "\\alternate_language \"" << spellchecker_alt_lang
2249 case RC_USE_ESC_CHARS:
2253 if (ignore_system_lyxrc ||
2254 spellchecker_esc_chars != system_lyxrc.spellchecker_esc_chars) {
2255 os << "\\escape_chars \"" << spellchecker_esc_chars << "\"\n";
2259 case RC_USE_PERS_DICT:
2263 case RC_USE_TOOLTIP:
2264 if (ignore_system_lyxrc ||
2265 use_tooltip != system_lyxrc.use_tooltip) {
2266 os << "\\use_tooltip "
2267 << convert<string>(use_tooltip)
2272 case RC_USE_PIXMAP_CACHE:
2273 if (ignore_system_lyxrc ||
2274 use_pixmap_cache != system_lyxrc.use_pixmap_cache) {
2275 os << "\\use_pixmap_cache "
2276 << convert<string>(use_pixmap_cache)
2285 case RC_USE_INP_ENC:
2291 << "# LANGUAGE SUPPORT SECTION ##########################\n"
2296 case RC_SPELLCHECKER:
2297 if (ignore_system_lyxrc ||
2298 spellchecker != system_lyxrc.spellchecker) {
2299 os << "\\spellchecker " << spellchecker << '\n';
2304 case RC_SPELLCHECK_CONTINUOUSLY:
2305 if (ignore_system_lyxrc ||
2306 spellcheck_continuously != system_lyxrc.spellcheck_continuously) {
2307 os << "\\spellcheck_continuously " << convert<string>(spellcheck_continuously)
2313 case RC_RTL_SUPPORT:
2314 if (ignore_system_lyxrc ||
2315 rtl_support != system_lyxrc.rtl_support) {
2316 os << "\\rtl " << convert<string>(rtl_support) << '\n';
2320 case RC_VISUAL_CURSOR:
2321 if (ignore_system_lyxrc ||
2322 visual_cursor != system_lyxrc.visual_cursor) {
2323 os << "\\visual_cursor " << convert<string>(visual_cursor) << '\n';
2327 case RC_LANGUAGE_PACKAGE:
2328 if (ignore_system_lyxrc ||
2329 language_package != system_lyxrc.language_package) {
2330 os << "\\language_package \"" << language_package
2335 case RC_LANGUAGE_GLOBAL_OPTIONS:
2336 if (ignore_system_lyxrc ||
2337 language_global_options
2338 != system_lyxrc.language_global_options) {
2339 os << "\\language_global_options \""
2340 << convert<string>(language_global_options)
2345 case RC_LANGUAGE_USE_BABEL:
2346 if (ignore_system_lyxrc ||
2347 language_use_babel != system_lyxrc.language_use_babel) {
2348 os << "\\language_use_babel \""
2349 << convert<string>(language_use_babel)
2354 case RC_LANGUAGE_COMMAND_BEGIN:
2355 if (ignore_system_lyxrc ||
2356 language_command_begin
2357 != system_lyxrc.language_command_begin) {
2358 os << "\\language_command_begin \""
2359 << language_command_begin
2364 case RC_LANGUAGE_COMMAND_END:
2365 if (ignore_system_lyxrc ||
2366 language_command_end
2367 != system_lyxrc.language_command_end) {
2368 os << "\\language_command_end \"" << language_command_end
2373 case RC_LANGUAGE_COMMAND_LOCAL:
2374 if (ignore_system_lyxrc ||
2375 language_command_local
2376 != system_lyxrc.language_command_local) {
2377 os << "\\language_command_local \""
2378 << language_command_local
2383 case RC_LANGUAGE_AUTO_BEGIN:
2384 if (ignore_system_lyxrc ||
2385 language_auto_begin != system_lyxrc.language_auto_begin) {
2386 os << "\\language_auto_begin "
2387 << convert<string>(language_auto_begin) << '\n';
2391 case RC_LANGUAGE_AUTO_END:
2392 if (ignore_system_lyxrc ||
2393 language_auto_end != system_lyxrc.language_auto_end) {
2394 os << "\\language_auto_end "
2395 << convert<string>(language_auto_end) << '\n';
2399 case RC_MARK_FOREIGN_LANGUAGE:
2400 if (ignore_system_lyxrc ||
2401 mark_foreign_language
2402 != system_lyxrc.mark_foreign_language) {
2403 os << "\\mark_foreign_language " <<
2404 convert<string>(mark_foreign_language) << '\n';
2410 << "# 2nd MISC SUPPORT SECTION ##########################\n"
2413 case RC_AUTO_NUMBER:
2414 if (ignore_system_lyxrc ||
2415 auto_number != system_lyxrc.auto_number) {
2416 os << "\\auto_number " << convert<string>(auto_number) << '\n';
2420 case RC_DEFAULT_LANGUAGE:
2421 if (ignore_system_lyxrc ||
2422 default_language != system_lyxrc.default_language) {
2423 os << "\\default_language " << default_language << '\n';
2427 case RC_GUI_LANGUAGE:
2428 if (ignore_system_lyxrc ||
2429 gui_language != system_lyxrc.gui_language) {
2430 os << "\\gui_language " << gui_language << '\n';
2436 << "# FORMATS SECTION ##########################\n"
2440 // New/modified formats
2441 for (Formats::const_iterator cit = formats.begin();
2442 cit != formats.end(); ++cit) {
2443 Format const * format =
2444 system_formats.getFormat(cit->name());
2446 format->extension() != cit->extension() ||
2447 format->prettyname() != cit->prettyname() ||
2448 format->shortcut() != cit->shortcut() ||
2449 format->viewer() != cit->viewer() ||
2450 format->editor() != cit->editor() ||
2451 format->documentFormat() != cit->documentFormat() ||
2452 format->vectorFormat() != cit->vectorFormat()) {
2453 os << "\\format \"" << cit->name() << "\" \""
2454 << cit->extension() << "\" \""
2455 << cit->prettyname() << "\" \""
2456 << cit->shortcut() << "\" \""
2457 << escapeCommand(cit->viewer()) << "\" \""
2458 << escapeCommand(cit->editor()) << "\" \"";
2459 vector<string> flags;
2460 if (cit->documentFormat())
2461 flags.push_back("document");
2462 if (cit->vectorFormat())
2463 flags.push_back("vector");
2464 os << getStringFromVector(flags);
2469 // Look for deleted formats
2470 for (Formats::const_iterator cit = system_formats.begin();
2471 cit != system_formats.end(); ++cit)
2472 if (!formats.getFormat(cit->name()))
2473 os << "\\format \"" << cit->name()
2474 << "\" \"\" \"\" \"\" \"\" \"\" \"\"\n";
2477 case RC_VIEWER_ALTERNATIVES:
2478 if (ignore_system_lyxrc ||
2479 viewer_alternatives != system_lyxrc.viewer_alternatives) {
2480 for (vector<pair<string, string> >::const_iterator it = viewer_alternatives.begin();
2481 it != viewer_alternatives.end(); ++it)
2482 os << "\\viewer_alternatives "
2483 << it->first << " " << it->second << "\n";
2487 case RC_EDITOR_ALTERNATIVES:
2488 if (ignore_system_lyxrc ||
2489 editor_alternatives != system_lyxrc.editor_alternatives) {
2490 for (vector<pair<string, string> >::const_iterator it = editor_alternatives.begin();
2491 it != editor_alternatives.end(); ++it)
2492 os << "\\editor_alternatives "
2493 << it->first << " " << it->second << "\n";
2497 case RC_DEFAULT_VIEW_FORMAT:
2498 if (ignore_system_lyxrc ||
2499 default_view_format != system_lyxrc.default_view_format) {
2500 os << "\\default_view_format " << default_view_format << '\n';
2510 << "# CONVERTERS SECTION ##########################\n"
2514 // Look for new converters
2515 for (Converters::const_iterator cit = theConverters().begin();
2516 cit != theConverters().end(); ++cit) {
2517 Converter const * converter =
2518 theSystemConverters().getConverter(cit->from,
2521 converter->command != cit->command ||
2522 converter->flags != cit->flags)
2523 os << "\\converter \"" << cit->from << "\" \""
2524 << cit->to << "\" \""
2525 << escapeCommand(cit->command) << "\" \""
2526 << cit->flags << "\"\n";
2529 // New/modifed converters
2530 for (Converters::const_iterator cit = theSystemConverters().begin();
2531 cit != theSystemConverters().end(); ++cit)
2532 if (!theConverters().getConverter(cit->from, cit->to))
2533 os << "\\converter \"" << cit->from
2534 << "\" \"" << cit->to << "\" \"\" \"\"\n";
2541 << "# COPIERS SECTION ##########################\n"
2544 // Look for new movers
2545 Movers::const_iterator const sysbegin = theSystemMovers().begin();
2546 Movers::const_iterator const sysend = theSystemMovers().end();
2547 Movers::const_iterator it = theMovers().begin();
2548 Movers::const_iterator end = theMovers().end();
2550 for (; it != end; ++it) {
2551 Movers::const_iterator const sysit =
2552 find_if(sysbegin, sysend, SameMover(*it));
2553 if (sysit == sysend) {
2554 string const & fmt = it->first;
2555 string const & command =
2556 it->second.command();
2558 os << "\\copier " << fmt
2559 << " \"" << escapeCommand(command) << "\"\n";
2565 // We don't actually delete SpecialisedMover(s) from the
2566 // map, just clear their 'command', so there's no need
2567 // to test for anything else.
2575 string const LyXRC::getDescription(LyXRCTags tag)
2580 case RC_ACCEPT_COMPOUND:
2581 str = _("Consider run-together words, such as \"diskdrive\" for \"disk drive\", as legal words?");
2585 case RC_USE_ALT_LANG:
2586 str = _("Specify an alternate language. The default is to use the language of the document.");
2589 case RC_PLAINTEXT_ROFF_COMMAND:
2590 str = _("Use to define an external program to render tables in plain text output. E.g. \"groff -t -Tlatin1 $$FName\" where $$FName is the input file. If \"\" is specified, an internal routine is used.");
2593 case RC_PLAINTEXT_LINELEN:
2594 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.");
2597 case RC_AUTOREGIONDELETE:
2598 str = _("De-select if you don't want the current selection to be replaced automatically by what you type.");
2601 case RC_AUTORESET_OPTIONS:
2602 str = _("De-select if you don't want the class options to be reset to defaults after class change.");
2606 str = _("The time interval between auto-saves (in seconds). 0 means no auto-save.");
2609 case RC_AUTO_NUMBER:
2612 case RC_BACKUPDIR_PATH:
2613 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.");
2616 case RC_BIBTEX_COMMAND:
2617 str = _("Define the options of bibtex (cf. man bibtex) or select an alternative compiler (e.g. mlbibtex or bibulus).");
2620 case RC_JBIBTEX_COMMAND:
2621 str = _("Define the options of the bibtex program for PLaTeX (Japanese LaTeX).");
2625 str = _("Keybindings file. Can either specify an absolute path, or LyX will look in its global and local bind/ directories.");
2628 case RC_CHECKLASTFILES:
2629 str = _("Select to check whether the lastfiles still exist.");
2632 case RC_CHKTEX_COMMAND:
2633 str = _("Define how to run chktex. E.g. \"chktex -n11 -n1 -n3 -n6 -n9 -22 -n25 -n30 -n38\" Refer to the ChkTeX documentation.");
2642 case RC_CURSOR_FOLLOWS_SCROLLBAR:
2643 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.");
2646 case RC_SCROLL_BELOW_DOCUMENT:
2647 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");
2650 case RC_MAC_LIKE_WORD_MOVEMENT:
2651 str = _("Use the Mac OS X conventions for the word-level cursor movement");
2654 case RC_SHOW_MACRO_LABEL:
2655 str = _("Show a small box around a Math Macro with the macro name when the cursor is inside.");
2658 case RC_DATE_INSERT_FORMAT:
2659 //xgettext:no-c-format
2660 str = _("This accepts the normal strftime formats; see man strftime for full details. E.g.\"%A, %e. %B %Y\".");
2664 str = _("Command definition file. Can either specify an absolute path, or LyX will look in its global and local commands/ directories.");
2667 case RC_DEFAULT_VIEW_FORMAT:
2668 str = _("The default format used with LFUN_BUFFER_[VIEW|UPDATE].");
2671 case RC_DEFAULT_LANGUAGE:
2672 str = _("New documents will be assigned this language.");
2675 case RC_DEFAULT_PAPERSIZE:
2676 str = _("Specify the default paper size.");
2679 case RC_DIALOGS_ICONIFY_WITH_MAIN:
2680 str = _("Iconify the dialogs when the main window is iconified. (Affects only dialogs shown after the change has been made.)");
2683 case RC_DISPLAY_GRAPHICS:
2684 str = _("Select how LyX will display any graphics.");
2687 case RC_DOCUMENTPATH:
2688 str = _("The default path for your documents. An empty value selects the directory LyX was started from.");
2692 case RC_USE_ESC_CHARS:
2693 str = _("Specify additional chars that can be part of a word.");
2696 case RC_EXAMPLEPATH:
2697 str = _("The path that LyX will set when offering to choose an example. An empty value selects the directory LyX was started from.");
2700 case RC_FONT_ENCODING:
2701 str = _("The font encoding used for the LaTeX2e fontenc package. T1 is highly recommended for non-English languages.");
2707 case RC_INDEX_COMMAND:
2708 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\".");
2711 case RC_JINDEX_COMMAND:
2712 str = _("Define the options of the index program for PLaTeX (Japanese LaTeX).");
2715 case RC_NOMENCL_COMMAND:
2716 str = _("Define the options of makeindex (cf. man makeindex) to be used for nomenclatures. This might differ from the index processing options.");
2723 case RC_KBMAP_PRIMARY:
2724 case RC_KBMAP_SECONDARY:
2725 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.");
2728 case RC_LABEL_INIT_LENGTH:
2729 str = _("Maximum number of words in the initialization string for a new label");
2732 case RC_LANGUAGE_AUTO_BEGIN:
2733 str = _("Select if a language switching command is needed at the beginning of the document.");
2736 case RC_LANGUAGE_AUTO_END:
2737 str = _("Select if a language switching command is needed at the end of the document.");
2740 case RC_LANGUAGE_COMMAND_BEGIN:
2741 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.");
2744 case RC_LANGUAGE_COMMAND_END:
2745 str = _("The LaTeX command for changing back to the language of the document.");
2748 case RC_LANGUAGE_COMMAND_LOCAL:
2749 str = _("The LaTeX command for local changing of the language.");
2752 case RC_LANGUAGE_GLOBAL_OPTIONS:
2753 str = _("De-select if you don't want the language(s) used as an argument to \\documentclass.");
2756 case RC_LANGUAGE_PACKAGE:
2757 str = _("The LaTeX command for loading the language package. E.g. \"\\usepackage{babel}\", \"\\usepackage{omega}\".");
2760 case RC_LANGUAGE_USE_BABEL:
2761 str = _("De-select if you don't want babel to be used when the language of the document is the default language.");
2764 case RC_USELASTFILEPOS:
2765 str = _("De-select if you do not want LyX to scroll to saved position.");
2768 case RC_LOADSESSION:
2769 str = _("De-select to prevent loading files opened from the last LyX session.");
2772 case RC_MAKE_BACKUP:
2773 str = _("De-select if you don't want LyX to create backup files.");
2776 case RC_MARK_FOREIGN_LANGUAGE:
2777 str = _("Select to control the highlighting of words with a language foreign to that of the document.");
2780 case RC_MOUSE_WHEEL_SPEED:
2781 str = bformat(_("The scrolling speed of the mouse wheel."),
2785 case RC_COMPLETION_POPUP_DELAY:
2786 str = _("The completion popup delay.");
2789 case RC_COMPLETION_POPUP_MATH:
2790 str = _("Select to display the completion popup in math mode.");
2793 case RC_COMPLETION_POPUP_TEXT:
2794 str = _("Select to display the completion popup in text mode.");
2797 case RC_COMPLETION_POPUP_AFTER_COMPLETE:
2798 str = _("Show the completion popup without delay after non-unique completion attempt.");
2801 case RC_COMPLETION_POPUP_TEXT:
2802 str = _("Show a small triangle on the cursor to indicate that a completion is available.");
2805 case RC_COMPLETION_POPUP_DELAY:
2806 str = _("The inline completion delay.");
2809 case RC_COMPLETION_INLINE_MATH:
2810 str = _("Select to display the inline completion in math mode.");
2813 case RC_COMPLETION_INLINE_TEXT:
2814 str = _("Select to display the inline completion in text mode.");
2817 case RC_COMPLETION_INLINE_DOTS:
2818 str = _("Use \"...\" to shorten long completions.");
2821 case RC_AUTOCORRECTION_MATH:
2822 str = _("Allow TeXMacs shorthand, like => converting to \Rightarrow.");
2825 case RC_NUMLASTFILES:
2826 str = bformat(_("Maximal number of lastfiles. Up to %1$d can appear in the file menu."),
2830 case RC_PATH_PREFIX:
2831 str = _("Specify those directories which should be "
2832 "prepended to the PATH environment variable. "
2833 "Use the OS native format.");
2837 str = _("Shows a typeset preview of things such as math");
2840 case RC_PREVIEW_HASHED_LABELS:
2841 str = _("Previewed equations will have \"(#)\" labels rather than numbered ones");
2844 case RC_PREVIEW_SCALE_FACTOR:
2845 str = _("Scale the preview size to suit.");
2848 case RC_PRINTCOLLCOPIESFLAG:
2849 str = _("The option for specifying whether the copies should be collated.");
2852 case RC_PRINTCOPIESFLAG:
2853 str = _("The option for specifying the number of copies to print.");
2857 str = _("The default printer to print on. If none is specified, LyX will use the environment variable PRINTER.");
2860 case RC_PRINTEVENPAGEFLAG:
2861 str = _("The option to print only even pages.");
2864 case RC_PRINTEXSTRAOPTIONS:
2865 str = _("Extra options to pass to printing program after everything else, but before the filename of the DVI file to be printed.");
2868 case RC_PRINTFILEEXTENSION:
2869 str = _("Extension of printer program output file. Usually \".ps\".");
2872 case RC_PRINTLANDSCAPEFLAG:
2873 str = _("The option to print out in landscape.");
2876 case RC_PRINTODDPAGEFLAG:
2877 str = _("The option to print only odd pages.");
2880 case RC_PRINTPAGERANGEFLAG:
2881 str = _("The option for specifying a comma-separated list of pages to print.");
2884 case RC_PRINTPAPERDIMENSIONFLAG:
2885 str = _("Option to specify the dimensions of the print paper.");
2888 case RC_PRINTPAPERFLAG:
2889 str = _("The option to specify paper type.");
2892 case RC_PRINTREVERSEFLAG:
2893 str = _("The option to reverse the order of the pages printed.");
2896 case RC_PRINTSPOOL_COMMAND:
2897 str = _("When set, this printer option automatically prints to a file and then calls a separate print spooling program on that file with the given name and arguments.");
2900 case RC_PRINTSPOOL_PRINTERPREFIX:
2901 str = _("If you specify a printer name in the print dialog, the following argument is prepended along with the printer name after the spool command.");
2904 case RC_PRINTTOFILE:
2905 str = _("Option to pass to the print program to print to a file.");
2908 case RC_PRINTTOPRINTER:
2909 str = _("Option to pass to the print program to print on a specific printer.");
2912 case RC_PRINT_ADAPTOUTPUT:
2913 str = _("Select for LyX to pass the name of the destination printer to your print command.");
2916 case RC_PRINT_COMMAND:
2917 str = _("Your favorite print program, e.g. \"dvips\", \"dvilj4\".");
2920 case RC_RTL_SUPPORT:
2921 str = _("Select to enable support of right-to-left languages (e.g. Hebrew, Arabic).");
2924 case RC_VISUAL_CURSOR:
2925 str = _("Select to have visual bidi cursor movement, unselect for logical movement.");
2929 str = _("DPI (dots per inch) of your monitor is auto-detected by LyX. If that goes wrong, override the setting here.");
2932 case RC_SCREEN_FONT_ROMAN:
2933 case RC_SCREEN_FONT_SANS:
2934 case RC_SCREEN_FONT_TYPEWRITER:
2935 str = _("The screen fonts used to display the text while editing.");
2938 case RC_SCREEN_FONT_ROMAN_FOUNDRY:
2939 case RC_SCREEN_FONT_SANS_FOUNDRY:
2940 case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
2943 case RC_SCREEN_FONT_SCALABLE:
2944 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.");
2947 case RC_SCREEN_FONT_SIZES:
2948 str = _("The font sizes used for calculating the scaling of the screen fonts.");
2951 case RC_SCREEN_ZOOM:
2952 //xgettext:no-c-format
2953 str = _("The zoom percentage for screen fonts. A setting of 100% will make the fonts roughly the same size as on paper.");
2956 case RC_GEOMETRY_SESSION:
2957 str = _("Allow session manager to save and restore windows geometry.");
2961 str = _("This starts the lyxserver. The pipes get an additional extension \".in\" and \".out\". Only for advanced users.");
2967 case RC_SHOW_BANNER:
2968 str = _("De-select if you don't want the startup banner.");
2971 case RC_TEMPDIRPATH:
2972 str = _("LyX will place its temporary directories in this path. They will be deleted when you quit LyX.");
2975 case RC_THESAURUSDIRPATH:
2976 str = _("This is the place where the files of the thesaurus library reside.");
2979 case RC_TEMPLATEPATH:
2980 str = _("The path that LyX will set when offering to choose a template. An empty value selects the directory LyX was started from.");
2983 case RC_TEX_ALLOWS_SPACES:
2986 case RC_TEX_EXPECTS_WINDOWS_PATHS:
2990 str = _("The UI (user interface) file. Can either specify an absolute path, or LyX will look in its global and local ui/ directories.");
3002 case RC_USE_TOOLTIP:
3003 str = _("Enable the automatic appearance of tool tips in the work area.");
3006 case RC_USE_PIXMAP_CACHE:
3007 str = _("Enable the pixmap cache that might improve performance on Mac and Windows.");
3010 case RC_USE_SPELL_LIB:
3013 case RC_VIEWDVI_PAPEROPTION:
3014 _("Specify the paper command to DVI viewer (leave empty or use \"-paper\")");
3029 // The global instance
3032 // The global copy of the system lyxrc entries (everything except preferences)