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 { "\\escape_chars", LyXRC::RC_ESC_CHARS },
91 { "\\example_path", LyXRC::RC_EXAMPLEPATH },
92 { "\\font_encoding", LyXRC::RC_FONT_ENCODING },
93 { "\\format", LyXRC::RC_FORMAT },
94 { "\\fullscreen_limit", LyXRC::RC_FULL_SCREEN_LIMIT },
95 { "\\fullscreen_menubar", LyXRC::RC_FULL_SCREEN_MENUBAR },
96 { "\\fullscreen_scrollbar", LyXRC::RC_FULL_SCREEN_SCROLLBAR },
97 { "\\fullscreen_tabbar", LyXRC::RC_FULL_SCREEN_TABBAR },
98 { "\\fullscreen_toolbars", LyXRC::RC_FULL_SCREEN_TOOLBARS },
99 { "\\fullscreen_width", LyXRC::RC_FULL_SCREEN_WIDTH },
100 { "\\group_layouts", LyXRC::RC_GROUP_LAYOUTS },
101 { "\\gui_language", LyXRC::RC_GUI_LANGUAGE },
102 { "\\index_alternatives", LyXRC::RC_INDEX_ALTERNATIVES },
103 { "\\index_command", LyXRC::RC_INDEX_COMMAND },
104 { "\\input", LyXRC::RC_INPUT },
105 { "\\jbibtex_command", LyXRC::RC_JBIBTEX_COMMAND },
106 { "\\jindex_command", LyXRC::RC_JINDEX_COMMAND },
107 { "\\kbmap", LyXRC::RC_KBMAP },
108 { "\\kbmap_primary", LyXRC::RC_KBMAP_PRIMARY },
109 { "\\kbmap_secondary", LyXRC::RC_KBMAP_SECONDARY },
110 { "\\label_init_length", LyXRC::RC_LABEL_INIT_LENGTH },
111 { "\\language_auto_begin", LyXRC::RC_LANGUAGE_AUTO_BEGIN },
112 { "\\language_auto_end", LyXRC::RC_LANGUAGE_AUTO_END },
113 { "\\language_command_begin", LyXRC::RC_LANGUAGE_COMMAND_BEGIN },
114 { "\\language_command_end", LyXRC::RC_LANGUAGE_COMMAND_END },
115 { "\\language_command_local", LyXRC::RC_LANGUAGE_COMMAND_LOCAL },
116 { "\\language_global_options", LyXRC::RC_LANGUAGE_GLOBAL_OPTIONS },
117 { "\\language_package", LyXRC::RC_LANGUAGE_PACKAGE },
118 { "\\language_use_babel", LyXRC::RC_LANGUAGE_USE_BABEL },
119 { "\\load_session", LyXRC::RC_LOADSESSION },
120 { "\\mac_like_word_movement", LyXRC::RC_MAC_LIKE_WORD_MOVEMENT },
121 { "\\macro_edit_style", LyXRC::RC_MACRO_EDIT_STYLE },
122 { "\\make_backup", LyXRC::RC_MAKE_BACKUP },
123 { "\\mark_foreign_language", LyXRC::RC_MARK_FOREIGN_LANGUAGE },
124 { "\\mouse_wheel_speed", LyXRC::RC_MOUSE_WHEEL_SPEED },
125 { "\\nomencl_command", LyXRC::RC_NOMENCL_COMMAND },
126 { "\\num_lastfiles", LyXRC::RC_NUMLASTFILES },
127 { "\\open_buffers_in_tabs", LyXRC::RC_OPEN_BUFFERS_IN_TABS },
128 { "\\path_prefix", LyXRC::RC_PATH_PREFIX },
129 { "\\personal_dictionary", LyXRC::RC_PERS_DICT },
130 { "\\plaintext_linelen", LyXRC::RC_PLAINTEXT_LINELEN },
131 { "\\plaintext_roff_command", LyXRC::RC_PLAINTEXT_ROFF_COMMAND },
132 { "\\preview", LyXRC::RC_PREVIEW },
133 { "\\preview_hashed_labels", LyXRC::RC_PREVIEW_HASHED_LABELS },
134 { "\\preview_scale_factor", LyXRC::RC_PREVIEW_SCALE_FACTOR },
135 { "\\print_adapt_output", LyXRC::RC_PRINT_ADAPTOUTPUT },
136 { "\\print_collcopies_flag", LyXRC::RC_PRINTCOLLCOPIESFLAG },
137 { "\\print_command", LyXRC::RC_PRINT_COMMAND },
138 { "\\print_copies_flag", LyXRC::RC_PRINTCOPIESFLAG },
139 { "\\print_evenpage_flag", LyXRC::RC_PRINTEVENPAGEFLAG },
140 { "\\print_extra_options", LyXRC::RC_PRINTEXSTRAOPTIONS },
141 { "\\print_file_extension", LyXRC::RC_PRINTFILEEXTENSION },
142 { "\\print_landscape_flag", LyXRC::RC_PRINTLANDSCAPEFLAG },
143 { "\\print_oddpage_flag", LyXRC::RC_PRINTODDPAGEFLAG },
144 { "\\print_pagerange_flag", LyXRC::RC_PRINTPAGERANGEFLAG },
145 { "\\print_paper_dimension_flag", LyXRC::RC_PRINTPAPERDIMENSIONFLAG },
146 { "\\print_paper_flag", LyXRC::RC_PRINTPAPERFLAG },
147 { "\\print_reverse_flag", LyXRC::RC_PRINTREVERSEFLAG },
148 { "\\print_spool_command", LyXRC::RC_PRINTSPOOL_COMMAND },
149 { "\\print_spool_printerprefix", LyXRC::RC_PRINTSPOOL_PRINTERPREFIX },
150 { "\\print_to_file", LyXRC::RC_PRINTTOFILE },
151 { "\\print_to_printer", LyXRC::RC_PRINTTOPRINTER },
152 { "\\printer", LyXRC::RC_PRINTER },
153 { "\\rtl", LyXRC::RC_RTL_SUPPORT },
154 { "\\screen_dpi", LyXRC::RC_SCREEN_DPI },
155 { "\\screen_font_roman", LyXRC::RC_SCREEN_FONT_ROMAN },
156 { "\\screen_font_roman_foundry", LyXRC::RC_SCREEN_FONT_ROMAN_FOUNDRY },
157 { "\\screen_font_sans", LyXRC::RC_SCREEN_FONT_SANS },
158 { "\\screen_font_sans_foundry", LyXRC::RC_SCREEN_FONT_SANS_FOUNDRY },
159 { "\\screen_font_scalable", LyXRC::RC_SCREEN_FONT_SCALABLE },
160 { "\\screen_font_sizes", LyXRC::RC_SCREEN_FONT_SIZES },
161 { "\\screen_font_typewriter", LyXRC::RC_SCREEN_FONT_TYPEWRITER },
162 { "\\screen_font_typewriter_foundry", LyXRC::RC_SCREEN_FONT_TYPEWRITER_FOUNDRY },
163 { "\\screen_zoom", LyXRC::RC_SCREEN_ZOOM },
164 { "\\scroll_below_document", LyXRC::RC_SCROLL_BELOW_DOCUMENT },
165 { "\\serverpipe", LyXRC::RC_SERVERPIPE },
166 { "\\set_color", LyXRC::RC_SET_COLOR },
167 { "\\show_banner", LyXRC::RC_SHOW_BANNER },
168 { "\\sort_layouts", LyXRC::RC_SORT_LAYOUTS },
169 { "\\spell_command", LyXRC::RC_SPELL_COMMAND },
170 { "\\spellcheck_continuously", LyXRC::RC_SPELLCHECK_CONTINUOUSLY },
171 { "\\splitindex_command", LyXRC::RC_SPLITINDEX_COMMAND },
172 { "\\tempdir_path", LyXRC::RC_TEMPDIRPATH },
173 { "\\template_path", LyXRC::RC_TEMPLATEPATH },
174 { "\\tex_allows_spaces", LyXRC::RC_TEX_ALLOWS_SPACES },
175 { "\\tex_expects_windows_paths", LyXRC::RC_TEX_EXPECTS_WINDOWS_PATHS },
176 { "\\thesaurusdir_path", LyXRC::RC_THESAURUSDIRPATH },
177 { "\\ui_file", LyXRC::RC_UIFILE },
178 { "\\use_alt_language", LyXRC::RC_USE_ALT_LANG },
179 { "\\use_converter_cache", LyXRC::RC_USE_CONVERTER_CACHE },
180 { "\\use_escape_chars", LyXRC::RC_USE_ESC_CHARS },
181 { "\\use_input_encoding", LyXRC::RC_USE_INP_ENC },
182 { "\\use_lastfilepos", LyXRC::RC_USELASTFILEPOS },
183 { "\\use_personal_dictionary", LyXRC::RC_USE_PERS_DICT },
184 { "\\use_pixmap_cache", LyXRC::RC_USE_PIXMAP_CACHE },
185 // compatibility with versions older than 1.4.0 only
186 { "\\use_pspell", LyXRC::RC_USE_SPELL_LIB },
187 // compatibility with versions older than 1.4.0 only
188 { "\\use_tempdir", LyXRC::RC_USETEMPDIR },
189 { "\\use_tooltip", LyXRC::RC_USE_TOOLTIP },
190 { "\\user_email", LyXRC::RC_USER_EMAIL },
191 { "\\user_name", LyXRC::RC_USER_NAME },
192 { "\\view_dvi_paper_option", LyXRC::RC_VIEWDVI_PAPEROPTION },
193 // compatibility with versions older than 1.4.0 only
194 { "\\viewer", LyXRC::RC_VIEWER},
195 { "\\visual_cursor" ,LyXRC::RC_VISUAL_CURSOR}
198 const int lyxrcCount = sizeof(lyxrcTags) / sizeof(lyxrcTags[0]);
209 void LyXRC::setDefaults()
212 def_file = "default";
214 // Get printer from the environment. If fail, use default "",
215 // assuming that everything is set up correctly.
216 printer = getEnv("PRINTER");
217 print_adapt_output = false;
218 print_command = "dvips";
219 print_evenpage_flag = "-B";
220 print_oddpage_flag = "-A";
221 print_pagerange_flag = "-pp";
222 print_copies_flag = "-c";
223 print_collcopies_flag = "-C";
224 print_reverse_flag = "-r";
225 print_landscape_flag = "-t landscape";
226 print_to_printer = "-P";
227 print_to_file = "-o ";
228 print_file_extension = ".ps";
229 print_paper_flag = "-t";
230 print_paper_dimension_flag = "-T";
231 document_path.erase();
232 view_dvi_paper_option.erase();
233 default_papersize = PAPER_DEFAULT;
234 default_view_format = "pdf2";
235 chktex_command = "chktex -n1 -n3 -n6 -n9 -n22 -n25 -n30 -n38";
236 bibtex_command = "bibtex";
238 index_command = "makeindex -c -q";
239 nomencl_command = "makeindex -s nomencl.ist";
241 // Because a screen typically is wider than a piece of paper:
243 allow_geometry_session = true;
244 // Default LaTeX font size:
245 font_sizes[FONT_SIZE_TINY] = "5.0";
246 font_sizes[FONT_SIZE_SCRIPT] = "7.0";
247 font_sizes[FONT_SIZE_FOOTNOTE] = "8.0";
248 font_sizes[FONT_SIZE_SMALL] = "9.0";
249 font_sizes[FONT_SIZE_NORMAL] = "10.0";
250 font_sizes[FONT_SIZE_LARGE] = "12.0";
251 font_sizes[FONT_SIZE_LARGER] = "14.4";
252 font_sizes[FONT_SIZE_LARGEST] = "17.26";
253 font_sizes[FONT_SIZE_HUGE] = "20.74";
254 font_sizes[FONT_SIZE_HUGER] = "24.88";
255 use_scalable_fonts = true;
256 roman_font_name = "";
258 typewriter_font_name = "";
260 auto_region_delete = true;
261 auto_reset_options = false;
262 plaintext_linelen = 65;
263 mouse_wheel_speed = 1.0;
264 num_lastfiles = maxlastfiles;
265 check_lastfiles = true;
266 use_lastfilepos = true;
267 load_session = false;
269 backupdir_path.erase();
270 display_graphics = true;
271 // Spellchecker settings:
272 spellchecker_accept_compound = false;
273 spellchecker_use_alt_lang = false;
274 spellchecker_use_esc_chars = false;
275 spellcheck_continuously = false;
278 visual_cursor = false;
280 mark_foreign_language = true;
281 language_auto_begin = true;
282 language_auto_end = true;
283 language_global_options = true;
284 language_use_babel = true;
285 language_package = "\\usepackage{babel}";
286 language_command_begin = "\\selectlanguage{$$lang}";
287 language_command_local = "\\foreignlanguage{$$lang}{";
288 sort_layouts = false;
289 group_layouts = true;
290 default_language = "english";
291 gui_language = "auto";
293 windows_style_tex_paths = false;
294 tex_allows_spaces = false;
295 date_insert_format = "%x";
296 cursor_follows_scrollbar = false;
297 scroll_below_document = false;
298 mac_like_word_movement = false;
299 macro_edit_style = MACRO_EDIT_INLINE_BOX;
300 dialogs_iconify_with_main = false;
301 label_init_length = 3;
302 preview = PREVIEW_OFF;
303 preview_hashed_labels = false;
304 preview_scale_factor = "0.9";
305 use_converter_cache = true;
307 use_pixmap_cache = false;
308 converter_cache_maxage = 6 * 30 * 24 * 3600; // 6 months
309 user_name = to_utf8(support::user_name());
310 user_email = to_utf8(support::user_email());
311 open_buffers_in_tabs = true;
313 // Fullscreen settings
314 full_screen_limit = false;
315 full_screen_toolbars = true;
316 full_screen_tabbar = true;
317 full_screen_menubar = true;
318 full_screen_scrollbar = true;
319 full_screen_width = 700;
321 completion_cursor_text = true;
322 completion_popup_math = true;
323 completion_popup_text = false;
324 completion_popup_delay = 2.0;
325 completion_popup_after_complete = true;
326 autocorrection_math = false;
327 completion_inline_math = true;
328 completion_inline_text = false;
329 completion_inline_dots = -1;
330 completion_inline_delay = 0.2;
336 void oldFontFormat(string & family, string & foundry)
338 if (family.empty() || family[0] != '-')
340 foundry = token(family, '-', 1);
341 family = token(family, '-', 2);
349 int LyXRC::read(FileName const & filename)
351 Lexer lexrc(lyxrcTags);
352 if (lyxerr.debugging(Debug::PARSER))
353 lexrc.printTable(lyxerr);
355 lexrc.setFile(filename);
359 LYXERR(Debug::LYXRC, "Reading '" << filename << "'...");
365 int LyXRC::read(istream & is)
367 Lexer lexrc(lyxrcTags);
368 if (lyxerr.debugging(Debug::PARSER))
369 lexrc.printTable(lyxerr);
375 LYXERR(Debug::LYXRC, "Reading istream...");
381 int LyXRC::read(Lexer & lexrc)
386 while (lexrc.isOK()) {
387 // By using two switches we take advantage of the compiler
388 // telling us if we have missed a LyXRCTags element in
389 // the second switch.
390 // Note that this also shows a problem with Lexer since it
391 // helps us avoid taking advantage of the strictness of the
394 int le = lexrc.lex();
396 case Lexer::LEX_UNDEF:
397 lexrc.printError("Unknown tag `$$Token'");
399 case Lexer::LEX_FEOF:
404 switch (static_cast<LyXRCTags>(le)) {
405 case RC_INPUT: // Include file
408 libFileSearch(string(),
411 lexrc.printError("Error reading "
412 "included file: " + tmp.absFilename());
418 bind_file = os::internal_path(lexrc.getString());
423 def_file = os::internal_path(lexrc.getString());
428 ui_file = os::internal_path(lexrc.getString());
431 case RC_AUTORESET_OPTIONS:
432 lexrc >> auto_reset_options;
435 case RC_DISPLAY_GRAPHICS:
437 display_graphics = lexrc.getString() == "true";
440 case RC_TEX_EXPECTS_WINDOWS_PATHS:
441 lexrc >> windows_style_tex_paths;
444 case RC_TEX_ALLOWS_SPACES:
445 lexrc >> tex_allows_spaces;
452 case RC_KBMAP_PRIMARY:
454 string const kmap(os::internal_path(lexrc.getString()));
457 } else if (!libFileSearch("kbd", kmap,
459 primary_kbmap = kmap;
461 lexrc.printError("LyX: Keymap `$$Token' not found");
466 case RC_KBMAP_SECONDARY:
468 string const kmap(os::internal_path(lexrc.getString()));
471 } else if (!libFileSearch("kbd", kmap,
473 secondary_kbmap = kmap;
475 lexrc.printError("LyX: Keymap `$$Token' not found");
480 case RC_FONT_ENCODING:
488 case RC_PRINT_COMMAND:
489 if (lexrc.next(true)) {
490 print_command = lexrc.getString();
494 case RC_PRINTEVENPAGEFLAG:
495 lexrc >> print_evenpage_flag;
498 case RC_PRINTODDPAGEFLAG:
499 lexrc >> print_oddpage_flag;
502 case RC_PRINTPAGERANGEFLAG:
503 lexrc >> print_pagerange_flag;
506 case RC_PRINTCOPIESFLAG:
507 lexrc >> print_copies_flag;
510 case RC_PRINTCOLLCOPIESFLAG:
511 lexrc >> print_collcopies_flag;
514 case RC_PRINTREVERSEFLAG:
515 lexrc >> print_reverse_flag;
518 case RC_PRINTLANDSCAPEFLAG:
519 lexrc >> print_landscape_flag;
522 case RC_PRINTTOPRINTER:
523 lexrc >> print_to_printer;
526 case RC_PRINT_ADAPTOUTPUT:
527 lexrc >> print_adapt_output;
532 print_to_file = os::internal_path(lexrc.getString());
536 case RC_PRINTFILEEXTENSION:
537 lexrc >> print_file_extension;
540 case RC_PRINTEXSTRAOPTIONS:
541 lexrc >> print_extra_options;
544 case RC_PRINTSPOOL_COMMAND:
545 if (lexrc.next(true)) {
546 print_spool_command = lexrc.getString();
550 case RC_PRINTSPOOL_PRINTERPREFIX:
551 lexrc >> print_spool_printerprefix;
554 case RC_PRINTPAPERDIMENSIONFLAG:
555 lexrc >> print_paper_dimension_flag;
558 case RC_PRINTPAPERFLAG:
559 lexrc >> print_paper_flag;
562 case RC_DEFAULT_PAPERSIZE:
564 string const size = ascii_lowercase(lexrc.getString());
565 if (size == "usletter")
566 default_papersize = PAPER_USLETTER;
567 else if (size == "legal")
568 default_papersize = PAPER_USLEGAL;
569 else if (size == "executive")
570 default_papersize = PAPER_USEXECUTIVE;
571 else if (size == "a3")
572 default_papersize = PAPER_A3;
573 else if (size == "a4")
574 default_papersize = PAPER_A4;
575 else if (size == "a5")
576 default_papersize = PAPER_A5;
577 else if (size == "b5")
578 default_papersize = PAPER_B5;
579 else if (size == "default")
580 default_papersize = PAPER_DEFAULT;
584 case RC_VIEWDVI_PAPEROPTION:
586 view_dvi_paper_option = lexrc.getString();
588 view_dvi_paper_option.erase();
591 case RC_CHKTEX_COMMAND:
592 if (lexrc.next(true)) {
593 chktex_command = lexrc.getString();
597 case RC_BIBTEX_ALTERNATIVES:
598 if (lexrc.next(true)) {
599 bibtex_alternatives.insert(lexrc.getString());
603 case RC_BIBTEX_COMMAND:
604 if (lexrc.next(true)) {
605 bibtex_command = lexrc.getString();
609 case RC_JBIBTEX_COMMAND:
610 if (lexrc.next(true)) {
611 jbibtex_command = lexrc.getString();
615 case RC_INDEX_ALTERNATIVES:
616 if (lexrc.next(true)) {
617 index_alternatives.insert(lexrc.getString());
621 case RC_INDEX_COMMAND:
622 if (lexrc.next(true)) {
623 index_command = lexrc.getString();
627 case RC_JINDEX_COMMAND:
628 if (lexrc.next(true)) {
629 jindex_command = lexrc.getString();
633 case RC_SPLITINDEX_COMMAND:
634 if (lexrc.next(true)) {
635 splitindex_command = lexrc.getString();
639 case RC_NOMENCL_COMMAND:
640 if (lexrc.next(true)) {
641 nomencl_command = lexrc.getString();
653 case RC_GEOMETRY_SESSION:
654 lexrc >> allow_geometry_session;
657 case RC_SCREEN_FONT_SIZES:
658 lexrc >> font_sizes[FONT_SIZE_TINY];
659 lexrc >> font_sizes[FONT_SIZE_SCRIPT];
660 lexrc >> font_sizes[FONT_SIZE_FOOTNOTE];
661 lexrc >> font_sizes[FONT_SIZE_SMALL];
662 lexrc >> font_sizes[FONT_SIZE_NORMAL];
663 lexrc >> font_sizes[FONT_SIZE_LARGE];
664 lexrc >> font_sizes[FONT_SIZE_LARGER];
665 lexrc >> font_sizes[FONT_SIZE_LARGEST];
666 lexrc >> font_sizes[FONT_SIZE_HUGE];
667 lexrc >> font_sizes[FONT_SIZE_HUGER];
670 case RC_SCREEN_FONT_SCALABLE:
671 lexrc >> use_scalable_fonts;
678 case RC_DOCUMENTPATH:
680 document_path = os::internal_path(lexrc.getString());
681 document_path = expandPath(document_path);
687 example_path = os::internal_path(lexrc.getString());
688 example_path = expandPath(example_path);
692 case RC_TEMPLATEPATH:
694 template_path = os::internal_path(lexrc.getString());
695 template_path = expandPath(template_path);
701 tempdir_path = os::internal_path(lexrc.getString());
702 tempdir_path = expandPath(tempdir_path);
706 case RC_THESAURUSDIRPATH:
708 thesaurusdir_path = os::internal_path(lexrc.getString());
709 thesaurusdir_path = expandPath(thesaurusdir_path);
713 case RC_USELASTFILEPOS:
714 lexrc >> use_lastfilepos;
718 lexrc >> load_session;
721 case RC_MOUSE_WHEEL_SPEED:
722 lexrc >> mouse_wheel_speed;
725 case RC_COMPLETION_INLINE_DELAY:
726 lexrc >> completion_inline_delay;
729 case RC_COMPLETION_INLINE_MATH:
730 lexrc >> completion_inline_math;
733 case RC_COMPLETION_INLINE_TEXT:
734 lexrc >> completion_inline_text;
737 case RC_COMPLETION_INLINE_DOTS:
738 lexrc >> completion_inline_dots;
741 case RC_AUTOCORRECTION_MATH:
742 lexrc >> autocorrection_math;
745 case RC_COMPLETION_POPUP_DELAY:
746 lexrc >> completion_popup_delay;
749 case RC_COMPLETION_POPUP_MATH:
750 lexrc >> completion_popup_math;
753 case RC_COMPLETION_POPUP_TEXT:
754 lexrc >> completion_popup_text;
757 case RC_COMPLETION_CURSOR_TEXT:
758 lexrc >> completion_cursor_text;
761 case RC_COMPLETION_POPUP_AFTER_COMPLETE:
762 lexrc >> completion_popup_after_complete;
765 case RC_NUMLASTFILES:
766 lexrc >> num_lastfiles;
769 case RC_CHECKLASTFILES:
770 lexrc >> check_lastfiles;
773 case RC_SCREEN_FONT_ROMAN:
775 roman_font_name = lexrc.getString();
776 oldFontFormat(roman_font_name,
781 case RC_SCREEN_FONT_SANS:
783 sans_font_name = lexrc.getString();
784 oldFontFormat(sans_font_name, sans_font_foundry);
788 case RC_SCREEN_FONT_TYPEWRITER:
790 typewriter_font_name = lexrc.getString();
791 oldFontFormat(typewriter_font_name,
792 typewriter_font_foundry);
796 case RC_SCREEN_FONT_ROMAN_FOUNDRY:
797 lexrc >> roman_font_foundry;
800 case RC_SCREEN_FONT_SANS_FOUNDRY:
801 lexrc >> sans_font_foundry;
804 case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
805 lexrc >> typewriter_font_foundry;
810 lexrc.printError("Missing color tag.");
813 string lyx_name = lexrc.getString();
816 lexrc.printError("Missing color name for color: `$$Token'");
819 string x11_name = lexrc.getString();
821 ColorCode const col =
822 lcolor.getFromLyXName(lyx_name);
823 if (col == Color_none ||
824 col == Color_inherit ||
828 if (!lcolor.setColor(col, x11_name))
829 LYXERR0("Bad lyxrc set_color for " << lyx_name);
833 case RC_AUTOREGIONDELETE:
834 // Auto region delete defaults to true
835 lexrc >> auto_region_delete;
840 lyxpipes = os::internal_path(lexrc.getString());
841 lyxpipes = expandPath(lyxpipes);
845 case RC_CURSOR_FOLLOWS_SCROLLBAR:
846 lexrc >> cursor_follows_scrollbar;
849 case RC_SCROLL_BELOW_DOCUMENT:
850 lexrc >> scroll_below_document;
853 case RC_MAC_LIKE_WORD_MOVEMENT:
854 lexrc >> mac_like_word_movement;
857 case RC_MACRO_EDIT_STYLE:
859 switch (lexrc.getInteger()) {
860 case 0: macro_edit_style = MACRO_EDIT_INLINE_BOX; break;
861 case 1: macro_edit_style = MACRO_EDIT_INLINE; break;
862 case 2: macro_edit_style = MACRO_EDIT_LIST; break;
867 case RC_DIALOGS_ICONIFY_WITH_MAIN:
868 lexrc >> dialogs_iconify_with_main;
871 case RC_PLAINTEXT_LINELEN:
872 lexrc >> plaintext_linelen;
874 // Spellchecker settings:
875 case RC_ACCEPT_COMPOUND:
876 lexrc >> spellchecker_accept_compound;
878 case RC_USE_ALT_LANG:
879 lexrc >> spellchecker_use_alt_lang;
882 lexrc >> use_tooltip;
884 case RC_USE_PIXMAP_CACHE:
885 lexrc >> use_pixmap_cache;
887 case RC_USE_ESC_CHARS:
888 lexrc >> spellchecker_use_esc_chars;
891 lexrc >> spellchecker_alt_lang;
894 lexrc >> spellchecker_esc_chars;
896 case RC_SPELLCHECK_CONTINUOUSLY:
897 lexrc >> spellcheck_continuously;
900 lexrc >> make_backup;
902 case RC_BACKUPDIR_PATH:
904 backupdir_path = os::internal_path(lexrc.getString());
905 backupdir_path = expandPath(backupdir_path);
908 case RC_DATE_INSERT_FORMAT:
909 lexrc >> date_insert_format;
911 case RC_LANGUAGE_PACKAGE:
912 lexrc >> language_package;
914 case RC_LANGUAGE_AUTO_BEGIN:
915 lexrc >> language_auto_begin;
917 case RC_LANGUAGE_AUTO_END:
918 lexrc >> language_auto_end;
920 case RC_LANGUAGE_GLOBAL_OPTIONS:
921 lexrc >> language_global_options;
923 case RC_LANGUAGE_USE_BABEL:
924 lexrc >> language_use_babel;
926 case RC_LANGUAGE_COMMAND_BEGIN:
927 lexrc >> language_command_begin;
929 case RC_LANGUAGE_COMMAND_END:
930 lexrc >> language_command_end;
932 case RC_LANGUAGE_COMMAND_LOCAL:
933 lexrc >> language_command_local;
936 lexrc >> rtl_support;
938 case RC_VISUAL_CURSOR:
939 lexrc >> visual_cursor;
942 lexrc >> auto_number;
944 case RC_MARK_FOREIGN_LANGUAGE:
945 lexrc >> mark_foreign_language;
951 fmt = lexrc.getString();
952 if (lexrc.next(true))
953 command = lexrc.getString();
954 setMover(fmt, command);
959 string from, to, command, flags;
961 from = lexrc.getString();
963 to = lexrc.getString();
964 if (lexrc.next(true))
965 command = lexrc.getString();
967 flags = lexrc.getString();
969 theConverters().erase(from, to);
971 theConverters().add(from, to, command, flags);
974 // compatibility with versions older than 1.4.0 only
976 string format, command;
977 lexrc >> format >> command;
978 formats.setViewer(format, command);
982 string format, extension, prettyname, shortcut;
983 lexrc >> format >> extension >> prettyname >> shortcut;
984 string viewer, editor;
985 if (lexrc.next(true))
986 viewer = lexrc.getString();
987 if (lexrc.next(true))
988 editor = lexrc.getString();
990 // Hack to ensure compatibility with versions older
992 int le = lexrc.lex();
993 if (le != Lexer::LEX_FEOF && le != Lexer::LEX_UNDEF) {
994 flags = lexrc.getString();
995 if (le != Lexer::LEX_DATA) {
996 // We have got a known token.
997 // Therefore this is an old style
998 // format definition without
1000 lexrc.pushToken(flags);
1004 int flgs = Format::none;
1005 while (!flags.empty()) {
1007 flags = split(flags, flag, ',');
1008 if (flag == "document")
1009 flgs |= Format::document;
1010 else if (flag == "vector")
1011 flgs |= Format::vector;
1013 LYXERR0("Ignoring unknown flag `"
1014 << flag << "' for format `"
1017 if (prettyname.empty()) {
1018 if (theConverters().formatIsUsed(format))
1019 LYXERR0("Can't delete format " << format);
1021 formats.erase(format);
1023 formats.add(format, extension, prettyname,
1024 shortcut, viewer, editor, flgs);
1028 case RC_DEFAULT_VIEW_FORMAT:
1029 lexrc >> default_view_format;
1032 case RC_DEFAULT_LANGUAGE:
1033 lexrc >> default_language;
1036 case RC_GUI_LANGUAGE:
1037 lexrc >> gui_language;
1040 case RC_LABEL_INIT_LENGTH:
1041 lexrc >> label_init_length;
1044 case RC_SHOW_BANNER:
1045 lexrc >> show_banner;
1050 string const tmp = lexrc.getString();
1051 if (tmp == "true" || tmp == "on")
1052 preview = PREVIEW_ON;
1053 else if (tmp == "no_math")
1054 preview = PREVIEW_NO_MATH;
1056 preview = PREVIEW_OFF;
1057 if (tmp != "false" && tmp != "off")
1058 LYXERR0("Unrecognized preview status \""
1064 case RC_PREVIEW_HASHED_LABELS:
1065 lexrc >> preview_hashed_labels;
1068 case RC_PREVIEW_SCALE_FACTOR:
1069 lexrc >> preview_scale_factor;
1076 lexrc >> user_email;
1079 case RC_PATH_PREFIX:
1080 lexrc >> path_prefix;
1083 case RC_USE_CONVERTER_CACHE:
1084 lexrc >> use_converter_cache;
1086 case RC_CONVERTER_CACHE_MAXAGE:
1087 lexrc >> converter_cache_maxage;
1090 case RC_SORT_LAYOUTS:
1091 lexrc >> sort_layouts;
1093 case RC_GROUP_LAYOUTS:
1094 lexrc >> group_layouts;
1096 case RC_FULL_SCREEN_LIMIT:
1097 lexrc >> full_screen_limit;
1099 case RC_FULL_SCREEN_TOOLBARS:
1100 lexrc >> full_screen_toolbars;
1102 case RC_FULL_SCREEN_SCROLLBAR:
1103 lexrc >> full_screen_scrollbar;
1105 case RC_FULL_SCREEN_TABBAR:
1106 lexrc >> full_screen_tabbar;
1108 case RC_FULL_SCREEN_MENUBAR:
1109 lexrc >> full_screen_menubar;
1111 case RC_FULL_SCREEN_WIDTH:
1112 lexrc >> full_screen_width;
1114 case RC_OPEN_BUFFERS_IN_TABS:
1115 lexrc >> open_buffers_in_tabs;
1118 // Obsoteted in 1.4.0
1121 case RC_SPELL_COMMAND:
1123 case RC_PLAINTEXT_ROFF_COMMAND:
1124 case RC_USE_INP_ENC:
1125 case RC_USE_PERS_DICT:
1126 case RC_USE_SPELL_LIB:
1127 LYXERR(Debug::LYXRC, "Skipping obsolete tag `"
1128 << lexrc.getString() << "'.");
1133 break; // this is just a dummy
1137 /// Update converters data-structures
1138 theConverters().update(formats);
1139 theConverters().buildGraph();
1145 void LyXRC::write(FileName const & filename, bool ignore_system_lyxrc) const
1147 ofstream ofs(filename.toFilesystemEncoding().c_str());
1149 write(ofs, ignore_system_lyxrc);
1153 void LyXRC::print() const
1155 if (lyxerr.debugging())
1156 write(lyxerr, false);
1164 typedef pair<string, SpecialisedMover> Data;
1166 SameMover(Data const & comparison)
1167 : comparison_(comparison) {}
1169 bool operator()(Data const & data) const
1171 return data.first == comparison_.first &&
1172 data.second.command() == comparison_.second.command();
1182 // Escape \ and " so that LyXLex can read the string later
1183 string escapeCommand(string const & str) {
1184 return subst(subst(str , "\\", "\\\\"),
1191 void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) const
1193 LyXRCTags tag = RC_LAST;
1195 if (!name.empty()) {
1196 for (int i = 0; i != lyxrcCount; ++i)
1197 if ("\\" + name == lyxrcTags[i].tag)
1198 tag = static_cast<LyXRCTags>(lyxrcTags[i].code);
1202 os << "# LyX " << lyx_version
1203 << " generated this file. If you want to make your own\n"
1204 << "# modifications you should do them from inside LyX and save.\n"
1207 // Why the switch you might ask. It is a trick to ensure that all
1208 // the elements in the LyXRCTags enum are handled. As you can see
1209 // there are no breaks at all. So it is just a huge fall-through.
1210 // The nice thing is that we will get a warning from the compiler
1211 // if we forget an element.
1215 // input/include files are not done here
1217 if (ignore_system_lyxrc ||
1218 bind_file != system_lyxrc.bind_file) {
1219 string const path = os::external_path(bind_file);
1220 os << "\\bind_file \"" << path << "\"\n";
1226 if (ignore_system_lyxrc ||
1227 def_file != system_lyxrc.def_file) {
1228 string const path = os::external_path(def_file);
1229 os << "\\def_file \"" << path << "\"\n";
1238 << "# MISC SECTION ######################################\n"
1240 // bind files are not done here.
1242 case RC_PATH_PREFIX:
1243 if (ignore_system_lyxrc ||
1244 path_prefix != system_lyxrc.path_prefix) {
1245 os << "\\path_prefix \"" << path_prefix << "\"\n";
1250 if (ignore_system_lyxrc ||
1251 ui_file != system_lyxrc.ui_file) {
1252 string const path = os::external_path(ui_file);
1253 os << "\\ui_file \"" << path << "\"\n";
1257 case RC_AUTOREGIONDELETE:
1258 if (ignore_system_lyxrc ||
1259 auto_region_delete != system_lyxrc.auto_region_delete) {
1260 os << "# Set to false to inhibit automatic replacement of\n"
1261 << "# the current selection.\n"
1262 << "\\auto_region_delete " << convert<string>(auto_region_delete)
1267 case RC_AUTORESET_OPTIONS:
1268 if (ignore_system_lyxrc ||
1269 auto_reset_options != system_lyxrc.auto_reset_options) {
1270 os << "# Set to false to inhibit automatic reset of\n"
1271 << "# the class options to defaults on class change.\n"
1272 << "\\auto_reset_options "
1273 << convert<string>(auto_reset_options)
1279 if (ignore_system_lyxrc ||
1280 autosave != system_lyxrc.autosave) {
1281 os << "# The time interval between auto-saves in seconds.\n"
1282 << "\\autosave " << autosave << '\n';
1286 case RC_DISPLAY_GRAPHICS:
1287 if (ignore_system_lyxrc ||
1288 display_graphics != system_lyxrc.display_graphics) {
1289 os << "# Display graphics within LyX\n"
1291 << "\\display_graphics "
1292 << (display_graphics ? "true" : "false")
1297 case RC_SORT_LAYOUTS:
1298 if (ignore_system_lyxrc ||
1299 sort_layouts != system_lyxrc.sort_layouts) {
1300 os << "# Sort layouts alphabetically.\n"
1301 << "\\sort_layouts " << convert<string>(sort_layouts) << '\n';
1305 case RC_GROUP_LAYOUTS:
1306 if (ignore_system_lyxrc ||
1307 group_layouts != system_lyxrc.group_layouts) {
1308 os << "# Group layouts by their category.\n"
1309 << "\\group_layouts " << convert<string>(group_layouts) << '\n';
1313 case RC_VIEWDVI_PAPEROPTION:
1314 if (ignore_system_lyxrc ||
1315 view_dvi_paper_option
1316 != system_lyxrc.view_dvi_paper_option) {
1317 os << "# Options used to specify paper size to the\n"
1318 << "# view_dvi_command (e.g. -paper)\n"
1319 << "\\view_dvi_paper_option \""
1320 << view_dvi_paper_option << "\"\n";
1324 case RC_DEFAULT_PAPERSIZE:
1325 if (ignore_system_lyxrc ||
1326 default_papersize != system_lyxrc.default_papersize) {
1327 os << "# The default papersize to use.\n"
1328 << "\\default_papersize \"";
1329 switch (default_papersize) {
1331 os << "default"; break;
1332 case PAPER_USLETTER:
1333 os << "usletter"; break;
1335 os << "legal"; break;
1336 case PAPER_USEXECUTIVE:
1337 os << "executive"; break;
1348 case PAPER_B4: break;
1354 case RC_CHKTEX_COMMAND:
1355 if (ignore_system_lyxrc ||
1356 chktex_command != system_lyxrc.chktex_command) {
1357 os << "\\chktex_command \"" << escapeCommand(chktex_command) << "\"\n";
1361 case RC_BIBTEX_ALTERNATIVES: {
1362 set<string>::const_iterator it = bibtex_alternatives.begin();
1363 set<string>::const_iterator end = bibtex_alternatives.end();
1364 for ( ; it != end; ++it) {
1365 if (ignore_system_lyxrc
1366 || !system_lyxrc.bibtex_alternatives.count(*it))
1367 os << "\\bibtex_alternatives \""
1373 case RC_BIBTEX_COMMAND:
1374 if (ignore_system_lyxrc ||
1375 bibtex_command != system_lyxrc.bibtex_command) {
1376 os << "\\bibtex_command \"" << escapeCommand(bibtex_command) << "\"\n";
1380 case RC_JBIBTEX_COMMAND:
1381 if (ignore_system_lyxrc ||
1382 jbibtex_command != system_lyxrc.jbibtex_command) {
1383 os << "\\jbibtex_command \"" << escapeCommand(jbibtex_command) << "\"\n";
1387 case RC_INDEX_ALTERNATIVES: {
1388 set<string>::const_iterator it = index_alternatives.begin();
1389 set<string>::const_iterator end = index_alternatives.end();
1390 for ( ; it != end; ++it) {
1391 if (ignore_system_lyxrc
1392 || !system_lyxrc.index_alternatives.count(*it))
1393 os << "\\index_alternatives \""
1399 case RC_INDEX_COMMAND:
1400 if (ignore_system_lyxrc ||
1401 index_command != system_lyxrc.index_command) {
1402 os << "\\index_command \"" << escapeCommand(index_command) << "\"\n";
1406 case RC_JINDEX_COMMAND:
1407 if (ignore_system_lyxrc ||
1408 jindex_command != system_lyxrc.jindex_command) {
1409 os << "\\jindex_command \"" << escapeCommand(jindex_command) << "\"\n";
1413 case RC_SPLITINDEX_COMMAND:
1414 if (ignore_system_lyxrc ||
1415 splitindex_command != system_lyxrc.splitindex_command) {
1416 os << "\\splitindex_command \"" << escapeCommand(splitindex_command) << "\"\n";
1420 case RC_NOMENCL_COMMAND:
1421 if (ignore_system_lyxrc ||
1422 nomencl_command != system_lyxrc.nomencl_command) {
1423 os << "\\nomencl_command \"" << escapeCommand(nomencl_command) << "\"\n";
1427 case RC_TEX_EXPECTS_WINDOWS_PATHS:
1428 if (ignore_system_lyxrc ||
1429 windows_style_tex_paths != system_lyxrc.windows_style_tex_paths) {
1430 os << "\\tex_expects_windows_paths "
1431 << convert<string>(windows_style_tex_paths) << '\n';
1435 case RC_TEX_ALLOWS_SPACES:
1436 if (tex_allows_spaces != system_lyxrc.tex_allows_spaces) {
1437 os << "\\tex_allows_spaces "
1438 << convert<string>(tex_allows_spaces) << '\n';
1443 if (ignore_system_lyxrc ||
1444 use_kbmap != system_lyxrc.use_kbmap) {
1445 os << "\\kbmap " << convert<string>(use_kbmap) << '\n';
1449 case RC_KBMAP_PRIMARY:
1450 if (ignore_system_lyxrc ||
1451 primary_kbmap != system_lyxrc.primary_kbmap) {
1452 string const path = os::external_path(primary_kbmap);
1453 os << "\\kbmap_primary \"" << path << "\"\n";
1457 case RC_KBMAP_SECONDARY:
1458 if (ignore_system_lyxrc ||
1459 secondary_kbmap != system_lyxrc.secondary_kbmap) {
1460 string const path = os::external_path(secondary_kbmap);
1461 os << "\\kbmap_secondary \"" << path << "\"\n";
1466 if (ignore_system_lyxrc ||
1467 lyxpipes != system_lyxrc.lyxpipes) {
1468 string const path = os::external_path(lyxpipes);
1469 os << "\\serverpipe \"" << path << "\"\n";
1473 case RC_DATE_INSERT_FORMAT:
1474 if (ignore_system_lyxrc ||
1475 date_insert_format != system_lyxrc.date_insert_format) {
1476 os << "\\date_insert_format \"" << date_insert_format
1481 case RC_LABEL_INIT_LENGTH:
1482 if (ignore_system_lyxrc ||
1483 label_init_length != system_lyxrc.label_init_length) {
1484 os << "\\label_init_length " << label_init_length
1491 os << "\\user_name \"" << user_name << "\"\n";
1496 os << "\\user_email \"" << user_email << "\"\n";
1500 case RC_SHOW_BANNER:
1501 if (ignore_system_lyxrc ||
1502 show_banner != system_lyxrc.show_banner) {
1503 os << "\\show_banner " << convert<string>(show_banner) << '\n';
1509 if (ignore_system_lyxrc ||
1510 preview != system_lyxrc.preview) {
1516 case PREVIEW_NO_MATH:
1523 os << "\\preview " << status << '\n';
1528 case RC_PREVIEW_HASHED_LABELS:
1529 if (ignore_system_lyxrc ||
1530 preview_hashed_labels !=
1531 system_lyxrc.preview_hashed_labels) {
1532 os << "\\preview_hashed_labels "
1533 << convert<string>(preview_hashed_labels) << '\n';
1538 case RC_PREVIEW_SCALE_FACTOR:
1539 if (ignore_system_lyxrc ||
1540 preview_scale_factor != system_lyxrc.preview_scale_factor) {
1541 os << "\\preview_scale_factor "
1542 << preview_scale_factor << '\n';
1547 case RC_USE_CONVERTER_CACHE:
1548 if (ignore_system_lyxrc ||
1549 use_converter_cache != system_lyxrc.use_converter_cache) {
1550 os << "\\use_converter_cache "
1551 << convert<string>(use_converter_cache) << '\n';
1556 case RC_CONVERTER_CACHE_MAXAGE:
1557 if (ignore_system_lyxrc ||
1558 converter_cache_maxage != system_lyxrc.converter_cache_maxage) {
1559 os << "\\converter_cache_maxage "
1560 << converter_cache_maxage << '\n';
1566 << "# SCREEN & FONTS SECTION ############################\n"
1570 if (ignore_system_lyxrc ||
1571 dpi != system_lyxrc.dpi) {
1572 os << "\\screen_dpi " << dpi << '\n';
1576 case RC_SCREEN_ZOOM:
1577 if (ignore_system_lyxrc ||
1578 zoom != system_lyxrc.zoom) {
1579 os << "\\screen_zoom " << zoom << '\n';
1583 case RC_GEOMETRY_SESSION:
1584 if (ignore_system_lyxrc ||
1585 allow_geometry_session != system_lyxrc.allow_geometry_session) {
1586 os << "\\allow_geometry_session " << convert<string>(allow_geometry_session)
1591 case RC_CURSOR_FOLLOWS_SCROLLBAR:
1592 if (ignore_system_lyxrc ||
1593 cursor_follows_scrollbar
1594 != system_lyxrc.cursor_follows_scrollbar) {
1595 os << "\\cursor_follows_scrollbar "
1596 << convert<string>(cursor_follows_scrollbar) << '\n';
1600 case RC_SCROLL_BELOW_DOCUMENT:
1601 if (ignore_system_lyxrc ||
1602 scroll_below_document
1603 != system_lyxrc.scroll_below_document) {
1604 os << "\\scroll_below_document "
1605 << convert<string>(scroll_below_document) << '\n';
1609 case RC_MAC_LIKE_WORD_MOVEMENT:
1610 if (ignore_system_lyxrc ||
1611 mac_like_word_movement
1612 != system_lyxrc.mac_like_word_movement) {
1613 os << "\\mac_like_word_movement "
1614 << convert<string>(mac_like_word_movement) << '\n';
1618 case RC_MACRO_EDIT_STYLE:
1619 if (ignore_system_lyxrc ||
1621 != system_lyxrc.macro_edit_style) {
1622 os << "\\macro_edit_style ";
1623 switch (macro_edit_style) {
1624 case MACRO_EDIT_INLINE_BOX: os << "0\n"; break;
1625 case MACRO_EDIT_INLINE: os << "1\n"; break;
1626 case MACRO_EDIT_LIST: os << "2\n"; break;
1631 case RC_DIALOGS_ICONIFY_WITH_MAIN:
1632 if (ignore_system_lyxrc ||
1633 dialogs_iconify_with_main
1634 != system_lyxrc.dialogs_iconify_with_main) {
1635 os << "\\dialogs_iconify_with_main "
1636 << convert<string>(dialogs_iconify_with_main) << '\n';
1640 case RC_SCREEN_FONT_ROMAN:
1641 if (ignore_system_lyxrc ||
1642 roman_font_name != system_lyxrc.roman_font_name) {
1643 os << "\\screen_font_roman \"" << roman_font_name
1648 case RC_SCREEN_FONT_ROMAN_FOUNDRY:
1649 if (ignore_system_lyxrc ||
1650 roman_font_foundry != system_lyxrc.roman_font_foundry) {
1651 os << "\\screen_font_roman_foundry \"" << roman_font_foundry
1656 case RC_SCREEN_FONT_SANS:
1657 if (ignore_system_lyxrc ||
1658 sans_font_name != system_lyxrc.sans_font_name) {
1659 os << "\\screen_font_sans \"" << sans_font_name
1664 case RC_SCREEN_FONT_SANS_FOUNDRY:
1665 if (ignore_system_lyxrc ||
1666 sans_font_foundry != system_lyxrc.sans_font_foundry) {
1667 os << "\\screen_font_sans_foundry \"" << sans_font_foundry
1672 case RC_SCREEN_FONT_TYPEWRITER:
1673 if (ignore_system_lyxrc ||
1674 typewriter_font_name != system_lyxrc.typewriter_font_name) {
1675 os << "\\screen_font_typewriter \""
1676 << typewriter_font_name << "\"\n";
1680 case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
1681 if (ignore_system_lyxrc ||
1682 typewriter_font_foundry != system_lyxrc.typewriter_font_foundry) {
1683 os << "\\screen_font_typewriter_foundry \""
1684 << typewriter_font_foundry << "\"\n";
1689 case RC_SCREEN_FONT_SCALABLE:
1690 if (ignore_system_lyxrc ||
1691 use_scalable_fonts != system_lyxrc.use_scalable_fonts) {
1692 os << "\\screen_font_scalable "
1693 << convert<string>(use_scalable_fonts)
1698 case RC_SCREEN_FONT_SIZES:
1699 if (ignore_system_lyxrc ||
1700 font_sizes[FONT_SIZE_TINY]
1701 != system_lyxrc.font_sizes[FONT_SIZE_TINY] ||
1702 font_sizes[FONT_SIZE_SCRIPT]
1703 != system_lyxrc.font_sizes[FONT_SIZE_SCRIPT] ||
1704 font_sizes[FONT_SIZE_FOOTNOTE]
1705 != system_lyxrc.font_sizes[FONT_SIZE_FOOTNOTE] ||
1706 font_sizes[FONT_SIZE_SMALL]
1707 != system_lyxrc.font_sizes[FONT_SIZE_SMALL] ||
1708 font_sizes[FONT_SIZE_NORMAL]
1709 != system_lyxrc.font_sizes[FONT_SIZE_NORMAL] ||
1710 font_sizes[FONT_SIZE_LARGE]
1711 != system_lyxrc.font_sizes[FONT_SIZE_LARGE] ||
1712 font_sizes[FONT_SIZE_LARGER]
1713 != system_lyxrc.font_sizes[FONT_SIZE_LARGER] ||
1714 font_sizes[FONT_SIZE_LARGEST]
1715 != system_lyxrc.font_sizes[FONT_SIZE_LARGEST] ||
1716 font_sizes[FONT_SIZE_HUGE]
1717 != system_lyxrc.font_sizes[FONT_SIZE_HUGE] ||
1718 font_sizes[FONT_SIZE_HUGER]
1719 != system_lyxrc.font_sizes[FONT_SIZE_HUGER]) {
1720 os.setf(ios::fixed);
1722 os << "\\screen_font_sizes"
1723 << ' ' << font_sizes[FONT_SIZE_TINY]
1724 << ' ' << font_sizes[FONT_SIZE_SCRIPT]
1725 << ' ' << font_sizes[FONT_SIZE_FOOTNOTE]
1726 << ' ' << font_sizes[FONT_SIZE_SMALL]
1727 << ' ' << font_sizes[FONT_SIZE_NORMAL]
1728 << ' ' << font_sizes[FONT_SIZE_LARGE]
1729 << ' ' << font_sizes[FONT_SIZE_LARGER]
1730 << ' ' << font_sizes[FONT_SIZE_LARGEST]
1731 << ' ' << font_sizes[FONT_SIZE_HUGE]
1732 << ' ' << font_sizes[FONT_SIZE_HUGER]
1737 case RC_FULL_SCREEN_LIMIT:
1738 if (ignore_system_lyxrc ||
1739 full_screen_limit != system_lyxrc.full_screen_limit) {
1740 os << "\\fullscreen_limit "
1741 << convert<string>(full_screen_limit)
1746 case RC_FULL_SCREEN_TOOLBARS:
1747 if (ignore_system_lyxrc ||
1748 full_screen_toolbars != system_lyxrc.full_screen_toolbars) {
1749 os << "\\fullscreen_toolbars "
1750 << convert<string>(full_screen_toolbars)
1755 case RC_FULL_SCREEN_SCROLLBAR:
1756 if (ignore_system_lyxrc ||
1757 full_screen_scrollbar != system_lyxrc.full_screen_scrollbar) {
1758 os << "\\fullscreen_scrollbar "
1759 << convert<string>(full_screen_scrollbar)
1764 case RC_FULL_SCREEN_TABBAR:
1765 if (ignore_system_lyxrc ||
1766 full_screen_tabbar != system_lyxrc.full_screen_tabbar) {
1767 os << "\\fullscreen_tabbar "
1768 << convert<string>(full_screen_tabbar)
1773 case RC_FULL_SCREEN_MENUBAR:
1774 if (ignore_system_lyxrc ||
1775 full_screen_menubar != system_lyxrc.full_screen_menubar) {
1776 os << "\\fullscreen_menubar "
1777 << convert<string>(full_screen_menubar)
1782 case RC_FULL_SCREEN_WIDTH:
1783 if (ignore_system_lyxrc ||
1784 full_screen_width != system_lyxrc.full_screen_width) {
1785 os << "\\fullscreen_width "
1786 << convert<string>(full_screen_width)
1791 case RC_OPEN_BUFFERS_IN_TABS:
1792 if (ignore_system_lyxrc ||
1793 open_buffers_in_tabs != system_lyxrc.open_buffers_in_tabs) {
1794 os << "\\open_buffers_in_tabs "
1795 << convert<string>(open_buffers_in_tabs)
1802 << "# COLOR SECTION ###################################\n"
1806 for (int i = 0; i < Color_ignore; ++i) {
1807 ColorCode lc = static_cast<ColorCode>(i);
1808 string const col = lcolor.getX11Name(lc);
1809 if (ignore_system_lyxrc
1810 || col != system_lcolor.getX11Name(lc)) {
1811 os << "\\set_color \""
1812 << lcolor.getLyXName(lc) << "\" \""
1820 << "# PRINTER SECTION ###################################\n"
1824 if (ignore_system_lyxrc ||
1825 printer != system_lyxrc.printer) {
1826 os << "\\printer \"" << printer << "\"\n";
1830 case RC_PRINT_ADAPTOUTPUT:
1831 if (ignore_system_lyxrc ||
1832 print_adapt_output != system_lyxrc.print_adapt_output) {
1833 os << "\\print_adapt_output "
1834 << convert<string>(print_adapt_output)
1839 case RC_PRINT_COMMAND:
1840 if (ignore_system_lyxrc ||
1841 print_command != system_lyxrc.print_command) {
1842 os << "\\print_command \"" << escapeCommand(print_command) << "\"\n";
1846 case RC_PRINTEXSTRAOPTIONS:
1847 if (ignore_system_lyxrc ||
1848 print_extra_options != system_lyxrc.print_extra_options) {
1849 os << "\\print_extra_options \"" << print_extra_options
1854 case RC_PRINTSPOOL_COMMAND:
1855 if (ignore_system_lyxrc ||
1856 print_spool_command != system_lyxrc.print_spool_command) {
1857 os << "\\print_spool_command \"" << escapeCommand(print_spool_command)
1862 case RC_PRINTSPOOL_PRINTERPREFIX:
1863 if (ignore_system_lyxrc ||
1864 print_spool_printerprefix
1865 != system_lyxrc.print_spool_printerprefix) {
1866 os << "\\print_spool_printerprefix \""
1867 << print_spool_printerprefix << "\"\n";
1871 case RC_PRINTEVENPAGEFLAG:
1872 if (ignore_system_lyxrc ||
1873 print_evenpage_flag != system_lyxrc.print_evenpage_flag) {
1874 os << "\\print_evenpage_flag \"" << print_evenpage_flag
1879 case RC_PRINTODDPAGEFLAG:
1880 if (ignore_system_lyxrc ||
1881 print_oddpage_flag != system_lyxrc.print_oddpage_flag) {
1882 os << "\\print_oddpage_flag \"" << print_oddpage_flag
1887 case RC_PRINTREVERSEFLAG:
1888 if (ignore_system_lyxrc ||
1889 print_reverse_flag != system_lyxrc.print_reverse_flag) {
1890 os << "\\print_reverse_flag \"" << print_reverse_flag
1895 case RC_PRINTLANDSCAPEFLAG:
1896 if (ignore_system_lyxrc ||
1897 print_landscape_flag != system_lyxrc.print_landscape_flag) {
1898 os << "\\print_landscape_flag \"" << print_landscape_flag
1903 case RC_PRINTPAGERANGEFLAG:
1904 if (ignore_system_lyxrc ||
1905 print_pagerange_flag != system_lyxrc.print_pagerange_flag) {
1906 os << "\\print_pagerange_flag \"" << print_pagerange_flag
1911 case RC_PRINTCOPIESFLAG:
1912 if (ignore_system_lyxrc ||
1913 print_copies_flag != system_lyxrc.print_copies_flag) {
1914 os << "\\print_copies_flag \"" << print_copies_flag
1919 case RC_PRINTCOLLCOPIESFLAG:
1920 if (ignore_system_lyxrc ||
1921 print_collcopies_flag
1922 != system_lyxrc.print_collcopies_flag) {
1923 os << "\\print_collcopies_flag \""
1924 << print_collcopies_flag
1929 case RC_PRINTPAPERFLAG:
1930 if (ignore_system_lyxrc ||
1931 print_paper_flag != system_lyxrc.print_paper_flag) {
1932 os << "\\print_paper_flag \"" << print_paper_flag
1937 case RC_PRINTPAPERDIMENSIONFLAG:
1938 if (ignore_system_lyxrc ||
1939 print_paper_dimension_flag
1940 != system_lyxrc.print_paper_dimension_flag) {
1941 os << "\\print_paper_dimension_flag \""
1942 << print_paper_dimension_flag << "\"\n";
1946 case RC_PRINTTOPRINTER:
1947 if (ignore_system_lyxrc ||
1948 print_to_printer != system_lyxrc.print_to_printer) {
1949 os << "\\print_to_printer \"" << print_to_printer
1954 case RC_PRINTTOFILE:
1955 if (ignore_system_lyxrc ||
1956 print_to_file != system_lyxrc.print_to_file) {
1957 string const path = os::external_path(print_to_file);
1958 os << "\\print_to_file \"" << path << "\"\n";
1962 case RC_PRINTFILEEXTENSION:
1963 if (ignore_system_lyxrc ||
1964 print_file_extension != system_lyxrc.print_file_extension) {
1965 os << "\\print_file_extension \""
1966 << print_file_extension
1973 << "# TEX SECTION #######################################\n"
1976 case RC_FONT_ENCODING:
1977 if (ignore_system_lyxrc ||
1978 fontenc != system_lyxrc.fontenc) {
1979 os << "\\font_encoding \"" << fontenc << "\"\n";
1985 << "# FILE SECTION ######################################\n"
1988 case RC_DOCUMENTPATH:
1989 if (ignore_system_lyxrc ||
1990 document_path != system_lyxrc.document_path) {
1991 string const path = os::external_path(document_path);
1992 os << "\\document_path \"" << path << "\"\n";
1996 case RC_USELASTFILEPOS:
1997 if (ignore_system_lyxrc ||
1998 use_lastfilepos != system_lyxrc.use_lastfilepos) {
1999 os << "\\use_lastfilepos " << convert<string>(use_lastfilepos)
2004 case RC_LOADSESSION:
2005 if (ignore_system_lyxrc ||
2006 load_session != system_lyxrc.load_session) {
2007 os << "\\load_session " << convert<string>(load_session)
2012 case RC_MOUSE_WHEEL_SPEED:
2013 if (ignore_system_lyxrc ||
2014 mouse_wheel_speed != system_lyxrc.mouse_wheel_speed) {
2015 os << "\\mouse_wheel_speed " << mouse_wheel_speed << '\n';
2019 case RC_COMPLETION_INLINE_DELAY:
2020 if (ignore_system_lyxrc ||
2021 completion_inline_delay != system_lyxrc.completion_inline_delay) {
2022 os << "\\completion_inline_delay " << completion_inline_delay << '\n';
2026 case RC_COMPLETION_INLINE_MATH:
2027 if (ignore_system_lyxrc ||
2028 completion_inline_math != system_lyxrc.completion_inline_math) {
2029 os << "\\completion_inline_math "
2030 << convert<string>(completion_inline_math) << '\n';
2034 case RC_COMPLETION_INLINE_TEXT:
2035 if (ignore_system_lyxrc ||
2036 completion_inline_text != system_lyxrc.completion_inline_text) {
2037 os << "\\completion_inline_text "
2038 << convert<string>(completion_inline_text) << '\n';
2042 case RC_COMPLETION_INLINE_DOTS:
2043 if (ignore_system_lyxrc ||
2044 completion_inline_dots != system_lyxrc.completion_inline_dots) {
2045 os << "\\completion_inline_dots "
2046 << convert<string>(completion_inline_dots) << '\n';
2050 case RC_AUTOCORRECTION_MATH:
2051 if (ignore_system_lyxrc ||
2052 autocorrection_math != system_lyxrc.autocorrection_math) {
2053 os << "\\autocorrection_math "
2054 << convert<string>(autocorrection_math) << '\n';
2058 case RC_COMPLETION_POPUP_DELAY:
2059 if (ignore_system_lyxrc ||
2060 completion_popup_delay != system_lyxrc.completion_popup_delay) {
2061 os << "\\completion_popup_delay " << completion_popup_delay << '\n';
2065 case RC_COMPLETION_POPUP_MATH:
2066 if (ignore_system_lyxrc ||
2067 completion_popup_math != system_lyxrc.completion_popup_math) {
2068 os << "\\completion_popup_math "
2069 << convert<string>(completion_popup_math) << '\n';
2073 case RC_COMPLETION_POPUP_TEXT:
2074 if (ignore_system_lyxrc ||
2075 completion_popup_text != system_lyxrc.completion_popup_text) {
2076 os << "\\completion_popup_text "
2077 << convert<string>(completion_popup_text) << '\n';
2081 case RC_COMPLETION_CURSOR_TEXT:
2082 if (ignore_system_lyxrc ||
2083 completion_cursor_text != system_lyxrc.completion_cursor_text) {
2084 os << "\\completion_cursor_text "
2085 << convert<string>(completion_cursor_text) << '\n';
2089 case RC_COMPLETION_POPUP_AFTER_COMPLETE:
2090 if (ignore_system_lyxrc ||
2091 completion_popup_after_complete
2092 != system_lyxrc.completion_popup_after_complete) {
2093 os << "\\completion_popup_after_complete "
2094 << convert<string>(completion_popup_after_complete) << '\n';
2098 case RC_NUMLASTFILES:
2099 if (ignore_system_lyxrc ||
2100 num_lastfiles != system_lyxrc.num_lastfiles) {
2101 os << "\\num_lastfiles " << num_lastfiles << '\n';
2105 case RC_CHECKLASTFILES:
2106 if (ignore_system_lyxrc ||
2107 check_lastfiles != system_lyxrc.check_lastfiles) {
2108 os << "\\check_lastfiles " << convert<string>(check_lastfiles)
2113 case RC_EXAMPLEPATH:
2114 if (ignore_system_lyxrc ||
2115 example_path != system_lyxrc.example_path) {
2116 string const path = os::external_path(example_path);
2117 os << "\\example_path \"" << path << "\"\n";
2121 case RC_TEMPLATEPATH:
2122 if (ignore_system_lyxrc ||
2123 template_path != system_lyxrc.template_path) {
2124 string const path = os::external_path(template_path);
2125 os << "\\template_path \"" << path << "\"\n";
2129 case RC_TEMPDIRPATH:
2130 if (ignore_system_lyxrc ||
2131 tempdir_path != system_lyxrc.tempdir_path) {
2132 string const path = os::external_path(tempdir_path);
2133 os << "\\tempdir_path \"" << path << "\"\n";
2137 case RC_THESAURUSDIRPATH:
2138 if (ignore_system_lyxrc ||
2139 thesaurusdir_path != system_lyxrc.thesaurusdir_path) {
2140 string const path = os::external_path(thesaurusdir_path);
2141 os << "\\thesaurusdir_path \"" << path << "\"\n";
2149 case RC_PLAINTEXT_ROFF_COMMAND: // Obsoleted in 2.0
2152 case RC_PLAINTEXT_LINELEN:
2153 if (ignore_system_lyxrc ||
2154 plaintext_linelen != system_lyxrc.plaintext_linelen) {
2155 os << "\\plaintext_linelen " << plaintext_linelen << '\n';
2159 case RC_MAKE_BACKUP:
2160 if (ignore_system_lyxrc ||
2161 make_backup != system_lyxrc.make_backup) {
2162 os << "\\make_backup " << convert<string>(make_backup) << '\n';
2166 case RC_BACKUPDIR_PATH:
2167 if (ignore_system_lyxrc ||
2168 backupdir_path != system_lyxrc.backupdir_path) {
2169 string const path = os::external_path(backupdir_path);
2170 os << "\\backupdir_path \"" << path << "\"\n";
2176 << "# PLAIN TEXT EXPORT SECTION ##############################\n"
2180 << "# SPELLCHECKER SECTION ##############################\n"
2183 case RC_SPELL_COMMAND:
2184 case RC_USE_SPELL_LIB:
2188 case RC_ACCEPT_COMPOUND:
2189 if (ignore_system_lyxrc ||
2190 spellchecker_accept_compound != system_lyxrc.spellchecker_accept_compound) {
2191 os << "\\accept_compound " << convert<string>(spellchecker_accept_compound)
2196 case RC_USE_ALT_LANG:
2197 if (ignore_system_lyxrc ||
2198 spellchecker_use_alt_lang != system_lyxrc.spellchecker_use_alt_lang) {
2199 os << "\\use_alt_language " << convert<string>(spellchecker_use_alt_lang)
2205 if (ignore_system_lyxrc ||
2206 spellchecker_alt_lang != system_lyxrc.spellchecker_alt_lang) {
2207 os << "\\alternate_language \"" << spellchecker_alt_lang
2212 case RC_USE_ESC_CHARS:
2213 if (ignore_system_lyxrc ||
2214 spellchecker_use_esc_chars != system_lyxrc.spellchecker_use_esc_chars) {
2215 os << "\\use_escape_chars " << convert<string>(spellchecker_use_esc_chars)
2221 if (ignore_system_lyxrc ||
2222 spellchecker_esc_chars != system_lyxrc.spellchecker_esc_chars) {
2223 os << "\\escape_chars \"" << spellchecker_esc_chars << "\"\n";
2227 case RC_USE_PERS_DICT:
2231 case RC_USE_TOOLTIP:
2232 if (ignore_system_lyxrc ||
2233 use_tooltip != system_lyxrc.use_tooltip) {
2234 os << "\\use_tooltip "
2235 << convert<string>(use_tooltip)
2240 case RC_USE_PIXMAP_CACHE:
2241 if (ignore_system_lyxrc ||
2242 use_pixmap_cache != system_lyxrc.use_pixmap_cache) {
2243 os << "\\use_pixmap_cache "
2244 << convert<string>(use_pixmap_cache)
2253 case RC_USE_INP_ENC:
2259 << "# LANGUAGE SUPPORT SECTION ##########################\n"
2264 case RC_SPELLCHECK_CONTINUOUSLY:
2265 if (ignore_system_lyxrc ||
2266 spellcheck_continuously != system_lyxrc.spellcheck_continuously) {
2267 os << "\\spellcheck_continuously " << convert<string>(spellcheck_continuously)
2273 case RC_RTL_SUPPORT:
2274 if (ignore_system_lyxrc ||
2275 rtl_support != system_lyxrc.rtl_support) {
2276 os << "\\rtl " << convert<string>(rtl_support) << '\n';
2280 case RC_VISUAL_CURSOR:
2281 if (ignore_system_lyxrc ||
2282 visual_cursor != system_lyxrc.visual_cursor) {
2283 os << "\\visual_cursor " << convert<string>(visual_cursor) << '\n';
2287 case RC_LANGUAGE_PACKAGE:
2288 if (ignore_system_lyxrc ||
2289 language_package != system_lyxrc.language_package) {
2290 os << "\\language_package \"" << language_package
2295 case RC_LANGUAGE_GLOBAL_OPTIONS:
2296 if (ignore_system_lyxrc ||
2297 language_global_options
2298 != system_lyxrc.language_global_options) {
2299 os << "\\language_global_options \""
2300 << convert<string>(language_global_options)
2305 case RC_LANGUAGE_USE_BABEL:
2306 if (ignore_system_lyxrc ||
2307 language_use_babel != system_lyxrc.language_use_babel) {
2308 os << "\\language_use_babel \""
2309 << convert<string>(language_use_babel)
2314 case RC_LANGUAGE_COMMAND_BEGIN:
2315 if (ignore_system_lyxrc ||
2316 language_command_begin
2317 != system_lyxrc.language_command_begin) {
2318 os << "\\language_command_begin \""
2319 << language_command_begin
2324 case RC_LANGUAGE_COMMAND_END:
2325 if (ignore_system_lyxrc ||
2326 language_command_end
2327 != system_lyxrc.language_command_end) {
2328 os << "\\language_command_end \"" << language_command_end
2333 case RC_LANGUAGE_COMMAND_LOCAL:
2334 if (ignore_system_lyxrc ||
2335 language_command_local
2336 != system_lyxrc.language_command_local) {
2337 os << "\\language_command_local \""
2338 << language_command_local
2343 case RC_LANGUAGE_AUTO_BEGIN:
2344 if (ignore_system_lyxrc ||
2345 language_auto_begin != system_lyxrc.language_auto_begin) {
2346 os << "\\language_auto_begin "
2347 << convert<string>(language_auto_begin) << '\n';
2351 case RC_LANGUAGE_AUTO_END:
2352 if (ignore_system_lyxrc ||
2353 language_auto_end != system_lyxrc.language_auto_end) {
2354 os << "\\language_auto_end "
2355 << convert<string>(language_auto_end) << '\n';
2359 case RC_MARK_FOREIGN_LANGUAGE:
2360 if (ignore_system_lyxrc ||
2361 mark_foreign_language
2362 != system_lyxrc.mark_foreign_language) {
2363 os << "\\mark_foreign_language " <<
2364 convert<string>(mark_foreign_language) << '\n';
2370 << "# 2nd MISC SUPPORT SECTION ##########################\n"
2373 case RC_AUTO_NUMBER:
2374 if (ignore_system_lyxrc ||
2375 auto_number != system_lyxrc.auto_number) {
2376 os << "\\auto_number " << convert<string>(auto_number) << '\n';
2380 case RC_DEFAULT_LANGUAGE:
2381 if (ignore_system_lyxrc ||
2382 default_language != system_lyxrc.default_language) {
2383 os << "\\default_language " << default_language << '\n';
2387 case RC_GUI_LANGUAGE:
2388 if (ignore_system_lyxrc ||
2389 gui_language != system_lyxrc.gui_language) {
2390 os << "\\gui_language " << gui_language << '\n';
2396 << "# FORMATS SECTION ##########################\n"
2400 // New/modified formats
2401 for (Formats::const_iterator cit = formats.begin();
2402 cit != formats.end(); ++cit) {
2403 Format const * format =
2404 system_formats.getFormat(cit->name());
2406 format->extension() != cit->extension() ||
2407 format->prettyname() != cit->prettyname() ||
2408 format->shortcut() != cit->shortcut() ||
2409 format->viewer() != cit->viewer() ||
2410 format->editor() != cit->editor() ||
2411 format->documentFormat() != cit->documentFormat() ||
2412 format->vectorFormat() != cit->vectorFormat()) {
2413 os << "\\format \"" << cit->name() << "\" \""
2414 << cit->extension() << "\" \""
2415 << cit->prettyname() << "\" \""
2416 << cit->shortcut() << "\" \""
2417 << escapeCommand(cit->viewer()) << "\" \""
2418 << escapeCommand(cit->editor()) << "\" \"";
2419 vector<string> flags;
2420 if (cit->documentFormat())
2421 flags.push_back("document");
2422 if (cit->vectorFormat())
2423 flags.push_back("vector");
2424 os << getStringFromVector(flags);
2429 // Look for deleted formats
2430 for (Formats::const_iterator cit = system_formats.begin();
2431 cit != system_formats.end(); ++cit)
2432 if (!formats.getFormat(cit->name()))
2433 os << "\\format \"" << cit->name()
2434 << "\" \"\" \"\" \"\" \"\" \"\" \"\"\n";
2437 case RC_DEFAULT_VIEW_FORMAT:
2438 if (ignore_system_lyxrc ||
2439 default_view_format != system_lyxrc.default_view_format) {
2440 os << "\\default_view_format " << default_view_format << '\n';
2450 << "# CONVERTERS SECTION ##########################\n"
2454 // Look for new converters
2455 for (Converters::const_iterator cit = theConverters().begin();
2456 cit != theConverters().end(); ++cit) {
2457 Converter const * converter =
2458 theSystemConverters().getConverter(cit->from,
2461 converter->command != cit->command ||
2462 converter->flags != cit->flags)
2463 os << "\\converter \"" << cit->from << "\" \""
2464 << cit->to << "\" \""
2465 << escapeCommand(cit->command) << "\" \""
2466 << cit->flags << "\"\n";
2469 // New/modifed converters
2470 for (Converters::const_iterator cit = theSystemConverters().begin();
2471 cit != theSystemConverters().end(); ++cit)
2472 if (!theConverters().getConverter(cit->from, cit->to))
2473 os << "\\converter \"" << cit->from
2474 << "\" \"" << cit->to << "\" \"\" \"\"\n";
2481 << "# COPIERS SECTION ##########################\n"
2484 // Look for new movers
2485 Movers::const_iterator const sysbegin = theSystemMovers().begin();
2486 Movers::const_iterator const sysend = theSystemMovers().end();
2487 Movers::const_iterator it = theMovers().begin();
2488 Movers::const_iterator end = theMovers().end();
2490 for (; it != end; ++it) {
2491 Movers::const_iterator const sysit =
2492 find_if(sysbegin, sysend, SameMover(*it));
2493 if (sysit == sysend) {
2494 string const & fmt = it->first;
2495 string const & command =
2496 it->second.command();
2498 os << "\\copier " << fmt
2499 << " \"" << escapeCommand(command) << "\"\n";
2505 // We don't actually delete SpecialisedMover(s) from the
2506 // map, just clear their 'command', so there's no need
2507 // to test for anything else.
2515 string const LyXRC::getDescription(LyXRCTags tag)
2520 case RC_ACCEPT_COMPOUND:
2521 str = _("Consider run-together words, such as \"diskdrive\" for \"disk drive\", as legal words?");
2525 case RC_USE_ALT_LANG:
2526 str = _("Specify an alternate language. The default is to use the language of the document.");
2529 case RC_PLAINTEXT_ROFF_COMMAND:
2530 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.");
2533 case RC_PLAINTEXT_LINELEN:
2534 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.");
2537 case RC_AUTOREGIONDELETE:
2538 str = _("De-select if you don't want the current selection to be replaced automatically by what you type.");
2541 case RC_AUTORESET_OPTIONS:
2542 str = _("De-select if you don't want the class options to be reset to defaults after class change.");
2546 str = _("The time interval between auto-saves (in seconds). 0 means no auto-save.");
2549 case RC_AUTO_NUMBER:
2552 case RC_BACKUPDIR_PATH:
2553 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.");
2556 case RC_BIBTEX_COMMAND:
2557 str = _("Define the options of bibtex (cf. man bibtex) or select an alternative compiler (e.g. mlbibtex or bibulus).");
2560 case RC_JBIBTEX_COMMAND:
2561 str = _("Define the options of the bibtex program for PLaTeX (Japanese LaTeX).");
2565 str = _("Keybindings file. Can either specify an absolute path, or LyX will look in its global and local bind/ directories.");
2568 case RC_CHECKLASTFILES:
2569 str = _("Select to check whether the lastfiles still exist.");
2572 case RC_CHKTEX_COMMAND:
2573 str = _("Define how to run chktex. E.g. \"chktex -n11 -n1 -n3 -n6 -n9 -22 -n25 -n30 -n38\" Refer to the ChkTeX documentation.");
2582 case RC_CURSOR_FOLLOWS_SCROLLBAR:
2583 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.");
2586 case RC_SCROLL_BELOW_DOCUMENT:
2587 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");
2590 case RC_MAC_LIKE_WORD_MOVEMENT:
2591 str = _("Use the Mac OS X conventions for the word-level cursor movement");
2594 case RC_SHOW_MACRO_LABEL:
2595 str = _("Show a small box around a Math Macro with the macro name when the cursor is inside.");
2598 case RC_DATE_INSERT_FORMAT:
2599 //xgettext:no-c-format
2600 str = _("This accepts the normal strftime formats; see man strftime for full details. E.g.\"%A, %e. %B %Y\".");
2604 str = _("Command definition file. Can either specify an absolute path, or LyX will look in its global and local commands/ directories.");
2607 case RC_DEFAULT_VIEW_FORMAT:
2608 str = _("The default format used with LFUN_BUFFER_[VIEW|UPDATE].");
2611 case RC_DEFAULT_LANGUAGE:
2612 str = _("New documents will be assigned this language.");
2615 case RC_DEFAULT_PAPERSIZE:
2616 str = _("Specify the default paper size.");
2619 case RC_DIALOGS_ICONIFY_WITH_MAIN:
2620 str = _("Iconify the dialogs when the main window is iconified. (Affects only dialogs shown after the change has been made.)");
2623 case RC_DISPLAY_GRAPHICS:
2624 str = _("Select how LyX will display any graphics.");
2627 case RC_DOCUMENTPATH:
2628 str = _("The default path for your documents. An empty value selects the directory LyX was started from.");
2632 case RC_USE_ESC_CHARS:
2633 str = _("Specify additional chars that can be part of a word.");
2636 case RC_EXAMPLEPATH:
2637 str = _("The path that LyX will set when offering to choose an example. An empty value selects the directory LyX was started from.");
2640 case RC_FONT_ENCODING:
2641 str = _("The font encoding used for the LaTeX2e fontenc package. T1 is highly recommended for non-English languages.");
2647 case RC_INDEX_COMMAND:
2648 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\".");
2651 case RC_JINDEX_COMMAND:
2652 str = _("Define the options of the index program for PLaTeX (Japanese LaTeX).");
2655 case RC_NOMENCL_COMMAND:
2656 str = _("Define the options of makeindex (cf. man makeindex) to be used for nomenclatures. This might differ from the index processing options.");
2663 case RC_KBMAP_PRIMARY:
2664 case RC_KBMAP_SECONDARY:
2665 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.");
2668 case RC_LABEL_INIT_LENGTH:
2669 str = _("Maximum number of words in the initialization string for a new label");
2672 case RC_LANGUAGE_AUTO_BEGIN:
2673 str = _("Select if a language switching command is needed at the beginning of the document.");
2676 case RC_LANGUAGE_AUTO_END:
2677 str = _("Select if a language switching command is needed at the end of the document.");
2680 case RC_LANGUAGE_COMMAND_BEGIN:
2681 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.");
2684 case RC_LANGUAGE_COMMAND_END:
2685 str = _("The LaTeX command for changing back to the language of the document.");
2688 case RC_LANGUAGE_COMMAND_LOCAL:
2689 str = _("The LaTeX command for local changing of the language.");
2692 case RC_LANGUAGE_GLOBAL_OPTIONS:
2693 str = _("De-select if you don't want the language(s) used as an argument to \\documentclass.");
2696 case RC_LANGUAGE_PACKAGE:
2697 str = _("The LaTeX command for loading the language package. E.g. \"\\usepackage{babel}\", \"\\usepackage{omega}\".");
2700 case RC_LANGUAGE_USE_BABEL:
2701 str = _("De-select if you don't want babel to be used when the language of the document is the default language.");
2704 case RC_USELASTFILEPOS:
2705 str = _("De-select if you do not want LyX to scroll to saved position.");
2708 case RC_LOADSESSION:
2709 str = _("De-select to prevent loading files opened from the last LyX session.");
2712 case RC_MAKE_BACKUP:
2713 str = _("De-select if you don't want LyX to create backup files.");
2716 case RC_MARK_FOREIGN_LANGUAGE:
2717 str = _("Select to control the highlighting of words with a language foreign to that of the document.");
2720 case RC_MOUSE_WHEEL_SPEED:
2721 str = bformat(_("The scrolling speed of the mouse wheel."),
2725 case RC_COMPLETION_POPUP_DELAY:
2726 str = _("The completion popup delay.");
2729 case RC_COMPLETION_POPUP_MATH:
2730 str = _("Select to display the completion popup in math mode.");
2733 case RC_COMPLETION_POPUP_TEXT:
2734 str = _("Select to display the completion popup in text mode.");
2737 case RC_COMPLETION_POPUP_AFTER_COMPLETE:
2738 str = _("Show the completion popup without delay after non-unique completion attempt.");
2741 case RC_COMPLETION_POPUP_TEXT:
2742 str = _("Show a small triangle on the cursor to indicate that a completion is available.");
2745 case RC_COMPLETION_POPUP_DELAY:
2746 str = _("The inline completion delay.");
2749 case RC_COMPLETION_INLINE_MATH:
2750 str = _("Select to display the inline completion in math mode.");
2753 case RC_COMPLETION_INLINE_TEXT:
2754 str = _("Select to display the inline completion in text mode.");
2757 case RC_COMPLETION_INLINE_DOTS:
2758 str = _("Use \"...\" to shorten long completions.");
2761 case RC_AUTOCORRECTION_MATH:
2762 str = _("Allow TeXMacs shorthand, like => converting to \Rightarrow.");
2765 case RC_NUMLASTFILES:
2766 str = bformat(_("Maximal number of lastfiles. Up to %1$d can appear in the file menu."),
2770 case RC_PATH_PREFIX:
2771 str = _("Specify those directories which should be "
2772 "prepended to the PATH environment variable. "
2773 "Use the OS native format.");
2777 str = _("Shows a typeset preview of things such as math");
2780 case RC_PREVIEW_HASHED_LABELS:
2781 str = _("Previewed equations will have \"(#)\" labels rather than numbered ones");
2784 case RC_PREVIEW_SCALE_FACTOR:
2785 str = _("Scale the preview size to suit.");
2788 case RC_PRINTCOLLCOPIESFLAG:
2789 str = _("The option for specifying whether the copies should be collated.");
2792 case RC_PRINTCOPIESFLAG:
2793 str = _("The option for specifying the number of copies to print.");
2797 str = _("The default printer to print on. If none is specified, LyX will use the environment variable PRINTER.");
2800 case RC_PRINTEVENPAGEFLAG:
2801 str = _("The option to print only even pages.");
2804 case RC_PRINTEXSTRAOPTIONS:
2805 str = _("Extra options to pass to printing program after everything else, but before the filename of the DVI file to be printed.");
2808 case RC_PRINTFILEEXTENSION:
2809 str = _("Extension of printer program output file. Usually \".ps\".");
2812 case RC_PRINTLANDSCAPEFLAG:
2813 str = _("The option to print out in landscape.");
2816 case RC_PRINTODDPAGEFLAG:
2817 str = _("The option to print only odd pages.");
2820 case RC_PRINTPAGERANGEFLAG:
2821 str = _("The option for specifying a comma-separated list of pages to print.");
2824 case RC_PRINTPAPERDIMENSIONFLAG:
2825 str = _("Option to specify the dimensions of the print paper.");
2828 case RC_PRINTPAPERFLAG:
2829 str = _("The option to specify paper type.");
2832 case RC_PRINTREVERSEFLAG:
2833 str = _("The option to reverse the order of the pages printed.");
2836 case RC_PRINTSPOOL_COMMAND:
2837 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.");
2840 case RC_PRINTSPOOL_PRINTERPREFIX:
2841 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.");
2844 case RC_PRINTTOFILE:
2845 str = _("Option to pass to the print program to print to a file.");
2848 case RC_PRINTTOPRINTER:
2849 str = _("Option to pass to the print program to print on a specific printer.");
2852 case RC_PRINT_ADAPTOUTPUT:
2853 str = _("Select for LyX to pass the name of the destination printer to your print command.");
2856 case RC_PRINT_COMMAND:
2857 str = _("Your favorite print program, e.g. \"dvips\", \"dvilj4\".");
2860 case RC_RTL_SUPPORT:
2861 str = _("Select to enable support of right-to-left languages (e.g. Hebrew, Arabic).");
2864 case RC_VISUAL_CURSOR:
2865 str = _("Select to have visual bidi cursor movement, unselect for logical movement.");
2869 str = _("DPI (dots per inch) of your monitor is auto-detected by LyX. If that goes wrong, override the setting here.");
2872 case RC_SCREEN_FONT_ROMAN:
2873 case RC_SCREEN_FONT_SANS:
2874 case RC_SCREEN_FONT_TYPEWRITER:
2875 str = _("The screen fonts used to display the text while editing.");
2878 case RC_SCREEN_FONT_ROMAN_FOUNDRY:
2879 case RC_SCREEN_FONT_SANS_FOUNDRY:
2880 case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
2883 case RC_SCREEN_FONT_SCALABLE:
2884 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.");
2887 case RC_SCREEN_FONT_SIZES:
2888 str = _("The font sizes used for calculating the scaling of the screen fonts.");
2891 case RC_SCREEN_ZOOM:
2892 //xgettext:no-c-format
2893 str = _("The zoom percentage for screen fonts. A setting of 100% will make the fonts roughly the same size as on paper.");
2896 case RC_GEOMETRY_SESSION:
2897 str = _("Allow session manager to save and restore windows geometry.");
2901 str = _("This starts the lyxserver. The pipes get an additional extension \".in\" and \".out\". Only for advanced users.");
2907 case RC_SHOW_BANNER:
2908 str = _("De-select if you don't want the startup banner.");
2911 case RC_TEMPDIRPATH:
2912 str = _("LyX will place its temporary directories in this path. They will be deleted when you quit LyX.");
2915 case RC_THESAURUSDIRPATH:
2916 str = _("This is the place where the files of the thesaurus library reside.");
2919 case RC_TEMPLATEPATH:
2920 str = _("The path that LyX will set when offering to choose a template. An empty value selects the directory LyX was started from.");
2923 case RC_TEX_ALLOWS_SPACES:
2926 case RC_TEX_EXPECTS_WINDOWS_PATHS:
2930 str = _("The UI (user interface) file. Can either specify an absolute path, or LyX will look in its global and local ui/ directories.");
2942 case RC_USE_TOOLTIP:
2943 str = _("Enable the automatic appearance of tool tips in the work area.");
2946 case RC_USE_PIXMAP_CACHE:
2947 str = _("Enable the pixmap cache that might improve performance on Mac and Windows.");
2950 case RC_USE_SPELL_LIB:
2953 case RC_VIEWDVI_PAPEROPTION:
2954 _("Specify the paper command to DVI viewer (leave empty or use \"-paper\")");
2969 // The global instance
2972 // The global copy of the system lyxrc entries (everything except preferences)