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 spellcheck_continuously = false;
276 visual_cursor = false;
278 mark_foreign_language = true;
279 language_auto_begin = true;
280 language_auto_end = true;
281 language_global_options = true;
282 language_use_babel = true;
283 language_package = "\\usepackage{babel}";
284 language_command_begin = "\\selectlanguage{$$lang}";
285 language_command_local = "\\foreignlanguage{$$lang}{";
286 sort_layouts = false;
287 group_layouts = true;
288 default_language = "english";
289 gui_language = "auto";
291 windows_style_tex_paths = false;
292 tex_allows_spaces = false;
293 date_insert_format = "%x";
294 cursor_follows_scrollbar = false;
295 scroll_below_document = false;
296 mac_like_word_movement = false;
297 macro_edit_style = MACRO_EDIT_INLINE_BOX;
298 dialogs_iconify_with_main = false;
299 label_init_length = 3;
300 preview = PREVIEW_OFF;
301 preview_hashed_labels = false;
302 preview_scale_factor = "0.9";
303 use_converter_cache = true;
305 use_pixmap_cache = false;
306 converter_cache_maxage = 6 * 30 * 24 * 3600; // 6 months
307 user_name = to_utf8(support::user_name());
308 user_email = to_utf8(support::user_email());
309 open_buffers_in_tabs = true;
311 // Fullscreen settings
312 full_screen_limit = false;
313 full_screen_toolbars = true;
314 full_screen_tabbar = true;
315 full_screen_menubar = true;
316 full_screen_scrollbar = true;
317 full_screen_width = 700;
319 completion_cursor_text = true;
320 completion_popup_math = true;
321 completion_popup_text = false;
322 completion_popup_delay = 2.0;
323 completion_popup_after_complete = true;
324 autocorrection_math = false;
325 completion_inline_math = true;
326 completion_inline_text = false;
327 completion_inline_dots = -1;
328 completion_inline_delay = 0.2;
334 void oldFontFormat(string & family, string & foundry)
336 if (family.empty() || family[0] != '-')
338 foundry = token(family, '-', 1);
339 family = token(family, '-', 2);
347 int LyXRC::read(FileName const & filename)
349 Lexer lexrc(lyxrcTags);
350 if (lyxerr.debugging(Debug::PARSER))
351 lexrc.printTable(lyxerr);
353 lexrc.setFile(filename);
357 LYXERR(Debug::LYXRC, "Reading '" << filename << "'...");
363 int LyXRC::read(istream & is)
365 Lexer lexrc(lyxrcTags);
366 if (lyxerr.debugging(Debug::PARSER))
367 lexrc.printTable(lyxerr);
373 LYXERR(Debug::LYXRC, "Reading istream...");
379 int LyXRC::read(Lexer & lexrc)
384 while (lexrc.isOK()) {
385 // By using two switches we take advantage of the compiler
386 // telling us if we have missed a LyXRCTags element in
387 // the second switch.
388 // Note that this also shows a problem with Lexer since it
389 // helps us avoid taking advantage of the strictness of the
392 int le = lexrc.lex();
394 case Lexer::LEX_UNDEF:
395 lexrc.printError("Unknown tag `$$Token'");
397 case Lexer::LEX_FEOF:
402 switch (static_cast<LyXRCTags>(le)) {
403 case RC_INPUT: // Include file
406 libFileSearch(string(),
409 lexrc.printError("Error reading "
410 "included file: " + tmp.absFilename());
416 bind_file = os::internal_path(lexrc.getString());
421 def_file = os::internal_path(lexrc.getString());
426 ui_file = os::internal_path(lexrc.getString());
429 case RC_AUTORESET_OPTIONS:
430 lexrc >> auto_reset_options;
433 case RC_DISPLAY_GRAPHICS:
435 display_graphics = lexrc.getString() == "true";
438 case RC_TEX_EXPECTS_WINDOWS_PATHS:
439 lexrc >> windows_style_tex_paths;
442 case RC_TEX_ALLOWS_SPACES:
443 lexrc >> tex_allows_spaces;
450 case RC_KBMAP_PRIMARY:
452 string const kmap(os::internal_path(lexrc.getString()));
455 } else if (!libFileSearch("kbd", kmap,
457 primary_kbmap = kmap;
459 lexrc.printError("LyX: Keymap `$$Token' not found");
464 case RC_KBMAP_SECONDARY:
466 string const kmap(os::internal_path(lexrc.getString()));
469 } else if (!libFileSearch("kbd", kmap,
471 secondary_kbmap = kmap;
473 lexrc.printError("LyX: Keymap `$$Token' not found");
478 case RC_FONT_ENCODING:
486 case RC_PRINT_COMMAND:
487 if (lexrc.next(true)) {
488 print_command = lexrc.getString();
492 case RC_PRINTEVENPAGEFLAG:
493 lexrc >> print_evenpage_flag;
496 case RC_PRINTODDPAGEFLAG:
497 lexrc >> print_oddpage_flag;
500 case RC_PRINTPAGERANGEFLAG:
501 lexrc >> print_pagerange_flag;
504 case RC_PRINTCOPIESFLAG:
505 lexrc >> print_copies_flag;
508 case RC_PRINTCOLLCOPIESFLAG:
509 lexrc >> print_collcopies_flag;
512 case RC_PRINTREVERSEFLAG:
513 lexrc >> print_reverse_flag;
516 case RC_PRINTLANDSCAPEFLAG:
517 lexrc >> print_landscape_flag;
520 case RC_PRINTTOPRINTER:
521 lexrc >> print_to_printer;
524 case RC_PRINT_ADAPTOUTPUT:
525 lexrc >> print_adapt_output;
530 print_to_file = os::internal_path(lexrc.getString());
534 case RC_PRINTFILEEXTENSION:
535 lexrc >> print_file_extension;
538 case RC_PRINTEXSTRAOPTIONS:
539 lexrc >> print_extra_options;
542 case RC_PRINTSPOOL_COMMAND:
543 if (lexrc.next(true)) {
544 print_spool_command = lexrc.getString();
548 case RC_PRINTSPOOL_PRINTERPREFIX:
549 lexrc >> print_spool_printerprefix;
552 case RC_PRINTPAPERDIMENSIONFLAG:
553 lexrc >> print_paper_dimension_flag;
556 case RC_PRINTPAPERFLAG:
557 lexrc >> print_paper_flag;
560 case RC_DEFAULT_PAPERSIZE:
562 string const size = ascii_lowercase(lexrc.getString());
563 if (size == "usletter")
564 default_papersize = PAPER_USLETTER;
565 else if (size == "legal")
566 default_papersize = PAPER_USLEGAL;
567 else if (size == "executive")
568 default_papersize = PAPER_USEXECUTIVE;
569 else if (size == "a3")
570 default_papersize = PAPER_A3;
571 else if (size == "a4")
572 default_papersize = PAPER_A4;
573 else if (size == "a5")
574 default_papersize = PAPER_A5;
575 else if (size == "b5")
576 default_papersize = PAPER_B5;
577 else if (size == "default")
578 default_papersize = PAPER_DEFAULT;
582 case RC_VIEWDVI_PAPEROPTION:
584 view_dvi_paper_option = lexrc.getString();
586 view_dvi_paper_option.erase();
589 case RC_CHKTEX_COMMAND:
590 if (lexrc.next(true)) {
591 chktex_command = lexrc.getString();
595 case RC_BIBTEX_ALTERNATIVES:
596 if (lexrc.next(true)) {
597 bibtex_alternatives.insert(lexrc.getString());
601 case RC_BIBTEX_COMMAND:
602 if (lexrc.next(true)) {
603 bibtex_command = lexrc.getString();
607 case RC_JBIBTEX_COMMAND:
608 if (lexrc.next(true)) {
609 jbibtex_command = lexrc.getString();
613 case RC_INDEX_ALTERNATIVES:
614 if (lexrc.next(true)) {
615 index_alternatives.insert(lexrc.getString());
619 case RC_INDEX_COMMAND:
620 if (lexrc.next(true)) {
621 index_command = lexrc.getString();
625 case RC_JINDEX_COMMAND:
626 if (lexrc.next(true)) {
627 jindex_command = lexrc.getString();
631 case RC_SPLITINDEX_COMMAND:
632 if (lexrc.next(true)) {
633 splitindex_command = lexrc.getString();
637 case RC_NOMENCL_COMMAND:
638 if (lexrc.next(true)) {
639 nomencl_command = lexrc.getString();
651 case RC_GEOMETRY_SESSION:
652 lexrc >> allow_geometry_session;
655 case RC_SCREEN_FONT_SIZES:
656 lexrc >> font_sizes[FONT_SIZE_TINY];
657 lexrc >> font_sizes[FONT_SIZE_SCRIPT];
658 lexrc >> font_sizes[FONT_SIZE_FOOTNOTE];
659 lexrc >> font_sizes[FONT_SIZE_SMALL];
660 lexrc >> font_sizes[FONT_SIZE_NORMAL];
661 lexrc >> font_sizes[FONT_SIZE_LARGE];
662 lexrc >> font_sizes[FONT_SIZE_LARGER];
663 lexrc >> font_sizes[FONT_SIZE_LARGEST];
664 lexrc >> font_sizes[FONT_SIZE_HUGE];
665 lexrc >> font_sizes[FONT_SIZE_HUGER];
668 case RC_SCREEN_FONT_SCALABLE:
669 lexrc >> use_scalable_fonts;
676 case RC_DOCUMENTPATH:
678 document_path = os::internal_path(lexrc.getString());
679 document_path = expandPath(document_path);
685 example_path = os::internal_path(lexrc.getString());
686 example_path = expandPath(example_path);
690 case RC_TEMPLATEPATH:
692 template_path = os::internal_path(lexrc.getString());
693 template_path = expandPath(template_path);
699 tempdir_path = os::internal_path(lexrc.getString());
700 tempdir_path = expandPath(tempdir_path);
704 case RC_THESAURUSDIRPATH:
706 thesaurusdir_path = os::internal_path(lexrc.getString());
707 thesaurusdir_path = expandPath(thesaurusdir_path);
711 case RC_USELASTFILEPOS:
712 lexrc >> use_lastfilepos;
716 lexrc >> load_session;
719 case RC_MOUSE_WHEEL_SPEED:
720 lexrc >> mouse_wheel_speed;
723 case RC_COMPLETION_INLINE_DELAY:
724 lexrc >> completion_inline_delay;
727 case RC_COMPLETION_INLINE_MATH:
728 lexrc >> completion_inline_math;
731 case RC_COMPLETION_INLINE_TEXT:
732 lexrc >> completion_inline_text;
735 case RC_COMPLETION_INLINE_DOTS:
736 lexrc >> completion_inline_dots;
739 case RC_AUTOCORRECTION_MATH:
740 lexrc >> autocorrection_math;
743 case RC_COMPLETION_POPUP_DELAY:
744 lexrc >> completion_popup_delay;
747 case RC_COMPLETION_POPUP_MATH:
748 lexrc >> completion_popup_math;
751 case RC_COMPLETION_POPUP_TEXT:
752 lexrc >> completion_popup_text;
755 case RC_COMPLETION_CURSOR_TEXT:
756 lexrc >> completion_cursor_text;
759 case RC_COMPLETION_POPUP_AFTER_COMPLETE:
760 lexrc >> completion_popup_after_complete;
763 case RC_NUMLASTFILES:
764 lexrc >> num_lastfiles;
767 case RC_CHECKLASTFILES:
768 lexrc >> check_lastfiles;
771 case RC_SCREEN_FONT_ROMAN:
773 roman_font_name = lexrc.getString();
774 oldFontFormat(roman_font_name,
779 case RC_SCREEN_FONT_SANS:
781 sans_font_name = lexrc.getString();
782 oldFontFormat(sans_font_name, sans_font_foundry);
786 case RC_SCREEN_FONT_TYPEWRITER:
788 typewriter_font_name = lexrc.getString();
789 oldFontFormat(typewriter_font_name,
790 typewriter_font_foundry);
794 case RC_SCREEN_FONT_ROMAN_FOUNDRY:
795 lexrc >> roman_font_foundry;
798 case RC_SCREEN_FONT_SANS_FOUNDRY:
799 lexrc >> sans_font_foundry;
802 case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
803 lexrc >> typewriter_font_foundry;
808 lexrc.printError("Missing color tag.");
811 string lyx_name = lexrc.getString();
814 lexrc.printError("Missing color name for color: `$$Token'");
817 string x11_name = lexrc.getString();
819 ColorCode const col =
820 lcolor.getFromLyXName(lyx_name);
821 if (col == Color_none ||
822 col == Color_inherit ||
826 if (!lcolor.setColor(col, x11_name))
827 LYXERR0("Bad lyxrc set_color for " << lyx_name);
831 case RC_AUTOREGIONDELETE:
832 // Auto region delete defaults to true
833 lexrc >> auto_region_delete;
838 lyxpipes = os::internal_path(lexrc.getString());
839 lyxpipes = expandPath(lyxpipes);
843 case RC_CURSOR_FOLLOWS_SCROLLBAR:
844 lexrc >> cursor_follows_scrollbar;
847 case RC_SCROLL_BELOW_DOCUMENT:
848 lexrc >> scroll_below_document;
851 case RC_MAC_LIKE_WORD_MOVEMENT:
852 lexrc >> mac_like_word_movement;
855 case RC_MACRO_EDIT_STYLE:
857 switch (lexrc.getInteger()) {
858 case 0: macro_edit_style = MACRO_EDIT_INLINE_BOX; break;
859 case 1: macro_edit_style = MACRO_EDIT_INLINE; break;
860 case 2: macro_edit_style = MACRO_EDIT_LIST; break;
865 case RC_DIALOGS_ICONIFY_WITH_MAIN:
866 lexrc >> dialogs_iconify_with_main;
869 case RC_PLAINTEXT_LINELEN:
870 lexrc >> plaintext_linelen;
872 // Spellchecker settings:
873 case RC_ACCEPT_COMPOUND:
874 lexrc >> spellchecker_accept_compound;
877 lexrc >> use_tooltip;
879 case RC_USE_PIXMAP_CACHE:
880 lexrc >> use_pixmap_cache;
883 lexrc >> spellchecker_alt_lang;
886 lexrc >> spellchecker_esc_chars;
888 case RC_SPELLCHECK_CONTINUOUSLY:
889 lexrc >> spellcheck_continuously;
892 lexrc >> make_backup;
894 case RC_BACKUPDIR_PATH:
896 backupdir_path = os::internal_path(lexrc.getString());
897 backupdir_path = expandPath(backupdir_path);
900 case RC_DATE_INSERT_FORMAT:
901 lexrc >> date_insert_format;
903 case RC_LANGUAGE_PACKAGE:
904 lexrc >> language_package;
906 case RC_LANGUAGE_AUTO_BEGIN:
907 lexrc >> language_auto_begin;
909 case RC_LANGUAGE_AUTO_END:
910 lexrc >> language_auto_end;
912 case RC_LANGUAGE_GLOBAL_OPTIONS:
913 lexrc >> language_global_options;
915 case RC_LANGUAGE_USE_BABEL:
916 lexrc >> language_use_babel;
918 case RC_LANGUAGE_COMMAND_BEGIN:
919 lexrc >> language_command_begin;
921 case RC_LANGUAGE_COMMAND_END:
922 lexrc >> language_command_end;
924 case RC_LANGUAGE_COMMAND_LOCAL:
925 lexrc >> language_command_local;
928 lexrc >> rtl_support;
930 case RC_VISUAL_CURSOR:
931 lexrc >> visual_cursor;
934 lexrc >> auto_number;
936 case RC_MARK_FOREIGN_LANGUAGE:
937 lexrc >> mark_foreign_language;
943 fmt = lexrc.getString();
944 if (lexrc.next(true))
945 command = lexrc.getString();
946 setMover(fmt, command);
951 string from, to, command, flags;
953 from = lexrc.getString();
955 to = lexrc.getString();
956 if (lexrc.next(true))
957 command = lexrc.getString();
959 flags = lexrc.getString();
961 theConverters().erase(from, to);
963 theConverters().add(from, to, command, flags);
966 // compatibility with versions older than 1.4.0 only
968 string format, command;
969 lexrc >> format >> command;
970 formats.setViewer(format, command);
974 string format, extension, prettyname, shortcut;
975 lexrc >> format >> extension >> prettyname >> shortcut;
976 string viewer, editor;
977 if (lexrc.next(true))
978 viewer = lexrc.getString();
979 if (lexrc.next(true))
980 editor = lexrc.getString();
982 // Hack to ensure compatibility with versions older
984 int le = lexrc.lex();
985 if (le != Lexer::LEX_FEOF && le != Lexer::LEX_UNDEF) {
986 flags = lexrc.getString();
987 if (le != Lexer::LEX_DATA) {
988 // We have got a known token.
989 // Therefore this is an old style
990 // format definition without
992 lexrc.pushToken(flags);
996 int flgs = Format::none;
997 while (!flags.empty()) {
999 flags = split(flags, flag, ',');
1000 if (flag == "document")
1001 flgs |= Format::document;
1002 else if (flag == "vector")
1003 flgs |= Format::vector;
1005 LYXERR0("Ignoring unknown flag `"
1006 << flag << "' for format `"
1009 if (prettyname.empty()) {
1010 if (theConverters().formatIsUsed(format))
1011 LYXERR0("Can't delete format " << format);
1013 formats.erase(format);
1015 formats.add(format, extension, prettyname,
1016 shortcut, viewer, editor, flgs);
1020 case RC_DEFAULT_VIEW_FORMAT:
1021 lexrc >> default_view_format;
1024 case RC_DEFAULT_LANGUAGE:
1025 lexrc >> default_language;
1028 case RC_GUI_LANGUAGE:
1029 lexrc >> gui_language;
1032 case RC_LABEL_INIT_LENGTH:
1033 lexrc >> label_init_length;
1036 case RC_SHOW_BANNER:
1037 lexrc >> show_banner;
1042 string const tmp = lexrc.getString();
1043 if (tmp == "true" || tmp == "on")
1044 preview = PREVIEW_ON;
1045 else if (tmp == "no_math")
1046 preview = PREVIEW_NO_MATH;
1048 preview = PREVIEW_OFF;
1049 if (tmp != "false" && tmp != "off")
1050 LYXERR0("Unrecognized preview status \""
1056 case RC_PREVIEW_HASHED_LABELS:
1057 lexrc >> preview_hashed_labels;
1060 case RC_PREVIEW_SCALE_FACTOR:
1061 lexrc >> preview_scale_factor;
1068 lexrc >> user_email;
1071 case RC_PATH_PREFIX:
1072 lexrc >> path_prefix;
1075 case RC_USE_CONVERTER_CACHE:
1076 lexrc >> use_converter_cache;
1078 case RC_CONVERTER_CACHE_MAXAGE:
1079 lexrc >> converter_cache_maxage;
1082 case RC_SORT_LAYOUTS:
1083 lexrc >> sort_layouts;
1085 case RC_GROUP_LAYOUTS:
1086 lexrc >> group_layouts;
1088 case RC_FULL_SCREEN_LIMIT:
1089 lexrc >> full_screen_limit;
1091 case RC_FULL_SCREEN_TOOLBARS:
1092 lexrc >> full_screen_toolbars;
1094 case RC_FULL_SCREEN_SCROLLBAR:
1095 lexrc >> full_screen_scrollbar;
1097 case RC_FULL_SCREEN_TABBAR:
1098 lexrc >> full_screen_tabbar;
1100 case RC_FULL_SCREEN_MENUBAR:
1101 lexrc >> full_screen_menubar;
1103 case RC_FULL_SCREEN_WIDTH:
1104 lexrc >> full_screen_width;
1106 case RC_OPEN_BUFFERS_IN_TABS:
1107 lexrc >> open_buffers_in_tabs;
1110 // Obsoteted in 1.4.0
1113 case RC_SPELL_COMMAND:
1115 case RC_PLAINTEXT_ROFF_COMMAND:
1116 case RC_USE_ALT_LANG:
1117 case RC_USE_ESC_CHARS:
1118 case RC_USE_INP_ENC:
1119 case RC_USE_PERS_DICT:
1120 case RC_USE_SPELL_LIB:
1121 LYXERR(Debug::LYXRC, "Skipping obsolete tag `"
1122 << lexrc.getString() << "'.");
1127 break; // this is just a dummy
1131 /// Update converters data-structures
1132 theConverters().update(formats);
1133 theConverters().buildGraph();
1139 void LyXRC::write(FileName const & filename, bool ignore_system_lyxrc) const
1141 ofstream ofs(filename.toFilesystemEncoding().c_str());
1143 write(ofs, ignore_system_lyxrc);
1147 void LyXRC::print() const
1149 if (lyxerr.debugging())
1150 write(lyxerr, false);
1158 typedef pair<string, SpecialisedMover> Data;
1160 SameMover(Data const & comparison)
1161 : comparison_(comparison) {}
1163 bool operator()(Data const & data) const
1165 return data.first == comparison_.first &&
1166 data.second.command() == comparison_.second.command();
1176 // Escape \ and " so that LyXLex can read the string later
1177 string escapeCommand(string const & str) {
1178 return subst(subst(str , "\\", "\\\\"),
1185 void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) const
1187 LyXRCTags tag = RC_LAST;
1189 if (!name.empty()) {
1190 for (int i = 0; i != lyxrcCount; ++i)
1191 if ("\\" + name == lyxrcTags[i].tag)
1192 tag = static_cast<LyXRCTags>(lyxrcTags[i].code);
1196 os << "# LyX " << lyx_version
1197 << " generated this file. If you want to make your own\n"
1198 << "# modifications you should do them from inside LyX and save.\n"
1201 // Why the switch you might ask. It is a trick to ensure that all
1202 // the elements in the LyXRCTags enum are handled. As you can see
1203 // there are no breaks at all. So it is just a huge fall-through.
1204 // The nice thing is that we will get a warning from the compiler
1205 // if we forget an element.
1209 // input/include files are not done here
1211 if (ignore_system_lyxrc ||
1212 bind_file != system_lyxrc.bind_file) {
1213 string const path = os::external_path(bind_file);
1214 os << "\\bind_file \"" << path << "\"\n";
1220 if (ignore_system_lyxrc ||
1221 def_file != system_lyxrc.def_file) {
1222 string const path = os::external_path(def_file);
1223 os << "\\def_file \"" << path << "\"\n";
1232 << "# MISC SECTION ######################################\n"
1234 // bind files are not done here.
1236 case RC_PATH_PREFIX:
1237 if (ignore_system_lyxrc ||
1238 path_prefix != system_lyxrc.path_prefix) {
1239 os << "\\path_prefix \"" << path_prefix << "\"\n";
1244 if (ignore_system_lyxrc ||
1245 ui_file != system_lyxrc.ui_file) {
1246 string const path = os::external_path(ui_file);
1247 os << "\\ui_file \"" << path << "\"\n";
1251 case RC_AUTOREGIONDELETE:
1252 if (ignore_system_lyxrc ||
1253 auto_region_delete != system_lyxrc.auto_region_delete) {
1254 os << "# Set to false to inhibit automatic replacement of\n"
1255 << "# the current selection.\n"
1256 << "\\auto_region_delete " << convert<string>(auto_region_delete)
1261 case RC_AUTORESET_OPTIONS:
1262 if (ignore_system_lyxrc ||
1263 auto_reset_options != system_lyxrc.auto_reset_options) {
1264 os << "# Set to false to inhibit automatic reset of\n"
1265 << "# the class options to defaults on class change.\n"
1266 << "\\auto_reset_options "
1267 << convert<string>(auto_reset_options)
1273 if (ignore_system_lyxrc ||
1274 autosave != system_lyxrc.autosave) {
1275 os << "# The time interval between auto-saves in seconds.\n"
1276 << "\\autosave " << autosave << '\n';
1280 case RC_DISPLAY_GRAPHICS:
1281 if (ignore_system_lyxrc ||
1282 display_graphics != system_lyxrc.display_graphics) {
1283 os << "# Display graphics within LyX\n"
1285 << "\\display_graphics "
1286 << (display_graphics ? "true" : "false")
1291 case RC_SORT_LAYOUTS:
1292 if (ignore_system_lyxrc ||
1293 sort_layouts != system_lyxrc.sort_layouts) {
1294 os << "# Sort layouts alphabetically.\n"
1295 << "\\sort_layouts " << convert<string>(sort_layouts) << '\n';
1299 case RC_GROUP_LAYOUTS:
1300 if (ignore_system_lyxrc ||
1301 group_layouts != system_lyxrc.group_layouts) {
1302 os << "# Group layouts by their category.\n"
1303 << "\\group_layouts " << convert<string>(group_layouts) << '\n';
1307 case RC_VIEWDVI_PAPEROPTION:
1308 if (ignore_system_lyxrc ||
1309 view_dvi_paper_option
1310 != system_lyxrc.view_dvi_paper_option) {
1311 os << "# Options used to specify paper size to the\n"
1312 << "# view_dvi_command (e.g. -paper)\n"
1313 << "\\view_dvi_paper_option \""
1314 << view_dvi_paper_option << "\"\n";
1318 case RC_DEFAULT_PAPERSIZE:
1319 if (ignore_system_lyxrc ||
1320 default_papersize != system_lyxrc.default_papersize) {
1321 os << "# The default papersize to use.\n"
1322 << "\\default_papersize \"";
1323 switch (default_papersize) {
1325 os << "default"; break;
1326 case PAPER_USLETTER:
1327 os << "usletter"; break;
1329 os << "legal"; break;
1330 case PAPER_USEXECUTIVE:
1331 os << "executive"; break;
1342 case PAPER_B4: break;
1348 case RC_CHKTEX_COMMAND:
1349 if (ignore_system_lyxrc ||
1350 chktex_command != system_lyxrc.chktex_command) {
1351 os << "\\chktex_command \"" << escapeCommand(chktex_command) << "\"\n";
1355 case RC_BIBTEX_ALTERNATIVES: {
1356 set<string>::const_iterator it = bibtex_alternatives.begin();
1357 set<string>::const_iterator end = bibtex_alternatives.end();
1358 for ( ; it != end; ++it) {
1359 if (ignore_system_lyxrc
1360 || !system_lyxrc.bibtex_alternatives.count(*it))
1361 os << "\\bibtex_alternatives \""
1367 case RC_BIBTEX_COMMAND:
1368 if (ignore_system_lyxrc ||
1369 bibtex_command != system_lyxrc.bibtex_command) {
1370 os << "\\bibtex_command \"" << escapeCommand(bibtex_command) << "\"\n";
1374 case RC_JBIBTEX_COMMAND:
1375 if (ignore_system_lyxrc ||
1376 jbibtex_command != system_lyxrc.jbibtex_command) {
1377 os << "\\jbibtex_command \"" << escapeCommand(jbibtex_command) << "\"\n";
1381 case RC_INDEX_ALTERNATIVES: {
1382 set<string>::const_iterator it = index_alternatives.begin();
1383 set<string>::const_iterator end = index_alternatives.end();
1384 for ( ; it != end; ++it) {
1385 if (ignore_system_lyxrc
1386 || !system_lyxrc.index_alternatives.count(*it))
1387 os << "\\index_alternatives \""
1393 case RC_INDEX_COMMAND:
1394 if (ignore_system_lyxrc ||
1395 index_command != system_lyxrc.index_command) {
1396 os << "\\index_command \"" << escapeCommand(index_command) << "\"\n";
1400 case RC_JINDEX_COMMAND:
1401 if (ignore_system_lyxrc ||
1402 jindex_command != system_lyxrc.jindex_command) {
1403 os << "\\jindex_command \"" << escapeCommand(jindex_command) << "\"\n";
1407 case RC_SPLITINDEX_COMMAND:
1408 if (ignore_system_lyxrc ||
1409 splitindex_command != system_lyxrc.splitindex_command) {
1410 os << "\\splitindex_command \"" << escapeCommand(splitindex_command) << "\"\n";
1414 case RC_NOMENCL_COMMAND:
1415 if (ignore_system_lyxrc ||
1416 nomencl_command != system_lyxrc.nomencl_command) {
1417 os << "\\nomencl_command \"" << escapeCommand(nomencl_command) << "\"\n";
1421 case RC_TEX_EXPECTS_WINDOWS_PATHS:
1422 if (ignore_system_lyxrc ||
1423 windows_style_tex_paths != system_lyxrc.windows_style_tex_paths) {
1424 os << "\\tex_expects_windows_paths "
1425 << convert<string>(windows_style_tex_paths) << '\n';
1429 case RC_TEX_ALLOWS_SPACES:
1430 if (tex_allows_spaces != system_lyxrc.tex_allows_spaces) {
1431 os << "\\tex_allows_spaces "
1432 << convert<string>(tex_allows_spaces) << '\n';
1437 if (ignore_system_lyxrc ||
1438 use_kbmap != system_lyxrc.use_kbmap) {
1439 os << "\\kbmap " << convert<string>(use_kbmap) << '\n';
1443 case RC_KBMAP_PRIMARY:
1444 if (ignore_system_lyxrc ||
1445 primary_kbmap != system_lyxrc.primary_kbmap) {
1446 string const path = os::external_path(primary_kbmap);
1447 os << "\\kbmap_primary \"" << path << "\"\n";
1451 case RC_KBMAP_SECONDARY:
1452 if (ignore_system_lyxrc ||
1453 secondary_kbmap != system_lyxrc.secondary_kbmap) {
1454 string const path = os::external_path(secondary_kbmap);
1455 os << "\\kbmap_secondary \"" << path << "\"\n";
1460 if (ignore_system_lyxrc ||
1461 lyxpipes != system_lyxrc.lyxpipes) {
1462 string const path = os::external_path(lyxpipes);
1463 os << "\\serverpipe \"" << path << "\"\n";
1467 case RC_DATE_INSERT_FORMAT:
1468 if (ignore_system_lyxrc ||
1469 date_insert_format != system_lyxrc.date_insert_format) {
1470 os << "\\date_insert_format \"" << date_insert_format
1475 case RC_LABEL_INIT_LENGTH:
1476 if (ignore_system_lyxrc ||
1477 label_init_length != system_lyxrc.label_init_length) {
1478 os << "\\label_init_length " << label_init_length
1485 os << "\\user_name \"" << user_name << "\"\n";
1490 os << "\\user_email \"" << user_email << "\"\n";
1494 case RC_SHOW_BANNER:
1495 if (ignore_system_lyxrc ||
1496 show_banner != system_lyxrc.show_banner) {
1497 os << "\\show_banner " << convert<string>(show_banner) << '\n';
1503 if (ignore_system_lyxrc ||
1504 preview != system_lyxrc.preview) {
1510 case PREVIEW_NO_MATH:
1517 os << "\\preview " << status << '\n';
1522 case RC_PREVIEW_HASHED_LABELS:
1523 if (ignore_system_lyxrc ||
1524 preview_hashed_labels !=
1525 system_lyxrc.preview_hashed_labels) {
1526 os << "\\preview_hashed_labels "
1527 << convert<string>(preview_hashed_labels) << '\n';
1532 case RC_PREVIEW_SCALE_FACTOR:
1533 if (ignore_system_lyxrc ||
1534 preview_scale_factor != system_lyxrc.preview_scale_factor) {
1535 os << "\\preview_scale_factor "
1536 << preview_scale_factor << '\n';
1541 case RC_USE_CONVERTER_CACHE:
1542 if (ignore_system_lyxrc ||
1543 use_converter_cache != system_lyxrc.use_converter_cache) {
1544 os << "\\use_converter_cache "
1545 << convert<string>(use_converter_cache) << '\n';
1550 case RC_CONVERTER_CACHE_MAXAGE:
1551 if (ignore_system_lyxrc ||
1552 converter_cache_maxage != system_lyxrc.converter_cache_maxage) {
1553 os << "\\converter_cache_maxage "
1554 << converter_cache_maxage << '\n';
1560 << "# SCREEN & FONTS SECTION ############################\n"
1564 if (ignore_system_lyxrc ||
1565 dpi != system_lyxrc.dpi) {
1566 os << "\\screen_dpi " << dpi << '\n';
1570 case RC_SCREEN_ZOOM:
1571 if (ignore_system_lyxrc ||
1572 zoom != system_lyxrc.zoom) {
1573 os << "\\screen_zoom " << zoom << '\n';
1577 case RC_GEOMETRY_SESSION:
1578 if (ignore_system_lyxrc ||
1579 allow_geometry_session != system_lyxrc.allow_geometry_session) {
1580 os << "\\allow_geometry_session " << convert<string>(allow_geometry_session)
1585 case RC_CURSOR_FOLLOWS_SCROLLBAR:
1586 if (ignore_system_lyxrc ||
1587 cursor_follows_scrollbar
1588 != system_lyxrc.cursor_follows_scrollbar) {
1589 os << "\\cursor_follows_scrollbar "
1590 << convert<string>(cursor_follows_scrollbar) << '\n';
1594 case RC_SCROLL_BELOW_DOCUMENT:
1595 if (ignore_system_lyxrc ||
1596 scroll_below_document
1597 != system_lyxrc.scroll_below_document) {
1598 os << "\\scroll_below_document "
1599 << convert<string>(scroll_below_document) << '\n';
1603 case RC_MAC_LIKE_WORD_MOVEMENT:
1604 if (ignore_system_lyxrc ||
1605 mac_like_word_movement
1606 != system_lyxrc.mac_like_word_movement) {
1607 os << "\\mac_like_word_movement "
1608 << convert<string>(mac_like_word_movement) << '\n';
1612 case RC_MACRO_EDIT_STYLE:
1613 if (ignore_system_lyxrc ||
1615 != system_lyxrc.macro_edit_style) {
1616 os << "\\macro_edit_style ";
1617 switch (macro_edit_style) {
1618 case MACRO_EDIT_INLINE_BOX: os << "0\n"; break;
1619 case MACRO_EDIT_INLINE: os << "1\n"; break;
1620 case MACRO_EDIT_LIST: os << "2\n"; break;
1625 case RC_DIALOGS_ICONIFY_WITH_MAIN:
1626 if (ignore_system_lyxrc ||
1627 dialogs_iconify_with_main
1628 != system_lyxrc.dialogs_iconify_with_main) {
1629 os << "\\dialogs_iconify_with_main "
1630 << convert<string>(dialogs_iconify_with_main) << '\n';
1634 case RC_SCREEN_FONT_ROMAN:
1635 if (ignore_system_lyxrc ||
1636 roman_font_name != system_lyxrc.roman_font_name) {
1637 os << "\\screen_font_roman \"" << roman_font_name
1642 case RC_SCREEN_FONT_ROMAN_FOUNDRY:
1643 if (ignore_system_lyxrc ||
1644 roman_font_foundry != system_lyxrc.roman_font_foundry) {
1645 os << "\\screen_font_roman_foundry \"" << roman_font_foundry
1650 case RC_SCREEN_FONT_SANS:
1651 if (ignore_system_lyxrc ||
1652 sans_font_name != system_lyxrc.sans_font_name) {
1653 os << "\\screen_font_sans \"" << sans_font_name
1658 case RC_SCREEN_FONT_SANS_FOUNDRY:
1659 if (ignore_system_lyxrc ||
1660 sans_font_foundry != system_lyxrc.sans_font_foundry) {
1661 os << "\\screen_font_sans_foundry \"" << sans_font_foundry
1666 case RC_SCREEN_FONT_TYPEWRITER:
1667 if (ignore_system_lyxrc ||
1668 typewriter_font_name != system_lyxrc.typewriter_font_name) {
1669 os << "\\screen_font_typewriter \""
1670 << typewriter_font_name << "\"\n";
1674 case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
1675 if (ignore_system_lyxrc ||
1676 typewriter_font_foundry != system_lyxrc.typewriter_font_foundry) {
1677 os << "\\screen_font_typewriter_foundry \""
1678 << typewriter_font_foundry << "\"\n";
1683 case RC_SCREEN_FONT_SCALABLE:
1684 if (ignore_system_lyxrc ||
1685 use_scalable_fonts != system_lyxrc.use_scalable_fonts) {
1686 os << "\\screen_font_scalable "
1687 << convert<string>(use_scalable_fonts)
1692 case RC_SCREEN_FONT_SIZES:
1693 if (ignore_system_lyxrc ||
1694 font_sizes[FONT_SIZE_TINY]
1695 != system_lyxrc.font_sizes[FONT_SIZE_TINY] ||
1696 font_sizes[FONT_SIZE_SCRIPT]
1697 != system_lyxrc.font_sizes[FONT_SIZE_SCRIPT] ||
1698 font_sizes[FONT_SIZE_FOOTNOTE]
1699 != system_lyxrc.font_sizes[FONT_SIZE_FOOTNOTE] ||
1700 font_sizes[FONT_SIZE_SMALL]
1701 != system_lyxrc.font_sizes[FONT_SIZE_SMALL] ||
1702 font_sizes[FONT_SIZE_NORMAL]
1703 != system_lyxrc.font_sizes[FONT_SIZE_NORMAL] ||
1704 font_sizes[FONT_SIZE_LARGE]
1705 != system_lyxrc.font_sizes[FONT_SIZE_LARGE] ||
1706 font_sizes[FONT_SIZE_LARGER]
1707 != system_lyxrc.font_sizes[FONT_SIZE_LARGER] ||
1708 font_sizes[FONT_SIZE_LARGEST]
1709 != system_lyxrc.font_sizes[FONT_SIZE_LARGEST] ||
1710 font_sizes[FONT_SIZE_HUGE]
1711 != system_lyxrc.font_sizes[FONT_SIZE_HUGE] ||
1712 font_sizes[FONT_SIZE_HUGER]
1713 != system_lyxrc.font_sizes[FONT_SIZE_HUGER]) {
1714 os.setf(ios::fixed);
1716 os << "\\screen_font_sizes"
1717 << ' ' << font_sizes[FONT_SIZE_TINY]
1718 << ' ' << font_sizes[FONT_SIZE_SCRIPT]
1719 << ' ' << font_sizes[FONT_SIZE_FOOTNOTE]
1720 << ' ' << font_sizes[FONT_SIZE_SMALL]
1721 << ' ' << font_sizes[FONT_SIZE_NORMAL]
1722 << ' ' << font_sizes[FONT_SIZE_LARGE]
1723 << ' ' << font_sizes[FONT_SIZE_LARGER]
1724 << ' ' << font_sizes[FONT_SIZE_LARGEST]
1725 << ' ' << font_sizes[FONT_SIZE_HUGE]
1726 << ' ' << font_sizes[FONT_SIZE_HUGER]
1731 case RC_FULL_SCREEN_LIMIT:
1732 if (ignore_system_lyxrc ||
1733 full_screen_limit != system_lyxrc.full_screen_limit) {
1734 os << "\\fullscreen_limit "
1735 << convert<string>(full_screen_limit)
1740 case RC_FULL_SCREEN_TOOLBARS:
1741 if (ignore_system_lyxrc ||
1742 full_screen_toolbars != system_lyxrc.full_screen_toolbars) {
1743 os << "\\fullscreen_toolbars "
1744 << convert<string>(full_screen_toolbars)
1749 case RC_FULL_SCREEN_SCROLLBAR:
1750 if (ignore_system_lyxrc ||
1751 full_screen_scrollbar != system_lyxrc.full_screen_scrollbar) {
1752 os << "\\fullscreen_scrollbar "
1753 << convert<string>(full_screen_scrollbar)
1758 case RC_FULL_SCREEN_TABBAR:
1759 if (ignore_system_lyxrc ||
1760 full_screen_tabbar != system_lyxrc.full_screen_tabbar) {
1761 os << "\\fullscreen_tabbar "
1762 << convert<string>(full_screen_tabbar)
1767 case RC_FULL_SCREEN_MENUBAR:
1768 if (ignore_system_lyxrc ||
1769 full_screen_menubar != system_lyxrc.full_screen_menubar) {
1770 os << "\\fullscreen_menubar "
1771 << convert<string>(full_screen_menubar)
1776 case RC_FULL_SCREEN_WIDTH:
1777 if (ignore_system_lyxrc ||
1778 full_screen_width != system_lyxrc.full_screen_width) {
1779 os << "\\fullscreen_width "
1780 << convert<string>(full_screen_width)
1785 case RC_OPEN_BUFFERS_IN_TABS:
1786 if (ignore_system_lyxrc ||
1787 open_buffers_in_tabs != system_lyxrc.open_buffers_in_tabs) {
1788 os << "\\open_buffers_in_tabs "
1789 << convert<string>(open_buffers_in_tabs)
1796 << "# COLOR SECTION ###################################\n"
1800 for (int i = 0; i < Color_ignore; ++i) {
1801 ColorCode lc = static_cast<ColorCode>(i);
1802 string const col = lcolor.getX11Name(lc);
1803 if (ignore_system_lyxrc
1804 || col != system_lcolor.getX11Name(lc)) {
1805 os << "\\set_color \""
1806 << lcolor.getLyXName(lc) << "\" \""
1814 << "# PRINTER SECTION ###################################\n"
1818 if (ignore_system_lyxrc ||
1819 printer != system_lyxrc.printer) {
1820 os << "\\printer \"" << printer << "\"\n";
1824 case RC_PRINT_ADAPTOUTPUT:
1825 if (ignore_system_lyxrc ||
1826 print_adapt_output != system_lyxrc.print_adapt_output) {
1827 os << "\\print_adapt_output "
1828 << convert<string>(print_adapt_output)
1833 case RC_PRINT_COMMAND:
1834 if (ignore_system_lyxrc ||
1835 print_command != system_lyxrc.print_command) {
1836 os << "\\print_command \"" << escapeCommand(print_command) << "\"\n";
1840 case RC_PRINTEXSTRAOPTIONS:
1841 if (ignore_system_lyxrc ||
1842 print_extra_options != system_lyxrc.print_extra_options) {
1843 os << "\\print_extra_options \"" << print_extra_options
1848 case RC_PRINTSPOOL_COMMAND:
1849 if (ignore_system_lyxrc ||
1850 print_spool_command != system_lyxrc.print_spool_command) {
1851 os << "\\print_spool_command \"" << escapeCommand(print_spool_command)
1856 case RC_PRINTSPOOL_PRINTERPREFIX:
1857 if (ignore_system_lyxrc ||
1858 print_spool_printerprefix
1859 != system_lyxrc.print_spool_printerprefix) {
1860 os << "\\print_spool_printerprefix \""
1861 << print_spool_printerprefix << "\"\n";
1865 case RC_PRINTEVENPAGEFLAG:
1866 if (ignore_system_lyxrc ||
1867 print_evenpage_flag != system_lyxrc.print_evenpage_flag) {
1868 os << "\\print_evenpage_flag \"" << print_evenpage_flag
1873 case RC_PRINTODDPAGEFLAG:
1874 if (ignore_system_lyxrc ||
1875 print_oddpage_flag != system_lyxrc.print_oddpage_flag) {
1876 os << "\\print_oddpage_flag \"" << print_oddpage_flag
1881 case RC_PRINTREVERSEFLAG:
1882 if (ignore_system_lyxrc ||
1883 print_reverse_flag != system_lyxrc.print_reverse_flag) {
1884 os << "\\print_reverse_flag \"" << print_reverse_flag
1889 case RC_PRINTLANDSCAPEFLAG:
1890 if (ignore_system_lyxrc ||
1891 print_landscape_flag != system_lyxrc.print_landscape_flag) {
1892 os << "\\print_landscape_flag \"" << print_landscape_flag
1897 case RC_PRINTPAGERANGEFLAG:
1898 if (ignore_system_lyxrc ||
1899 print_pagerange_flag != system_lyxrc.print_pagerange_flag) {
1900 os << "\\print_pagerange_flag \"" << print_pagerange_flag
1905 case RC_PRINTCOPIESFLAG:
1906 if (ignore_system_lyxrc ||
1907 print_copies_flag != system_lyxrc.print_copies_flag) {
1908 os << "\\print_copies_flag \"" << print_copies_flag
1913 case RC_PRINTCOLLCOPIESFLAG:
1914 if (ignore_system_lyxrc ||
1915 print_collcopies_flag
1916 != system_lyxrc.print_collcopies_flag) {
1917 os << "\\print_collcopies_flag \""
1918 << print_collcopies_flag
1923 case RC_PRINTPAPERFLAG:
1924 if (ignore_system_lyxrc ||
1925 print_paper_flag != system_lyxrc.print_paper_flag) {
1926 os << "\\print_paper_flag \"" << print_paper_flag
1931 case RC_PRINTPAPERDIMENSIONFLAG:
1932 if (ignore_system_lyxrc ||
1933 print_paper_dimension_flag
1934 != system_lyxrc.print_paper_dimension_flag) {
1935 os << "\\print_paper_dimension_flag \""
1936 << print_paper_dimension_flag << "\"\n";
1940 case RC_PRINTTOPRINTER:
1941 if (ignore_system_lyxrc ||
1942 print_to_printer != system_lyxrc.print_to_printer) {
1943 os << "\\print_to_printer \"" << print_to_printer
1948 case RC_PRINTTOFILE:
1949 if (ignore_system_lyxrc ||
1950 print_to_file != system_lyxrc.print_to_file) {
1951 string const path = os::external_path(print_to_file);
1952 os << "\\print_to_file \"" << path << "\"\n";
1956 case RC_PRINTFILEEXTENSION:
1957 if (ignore_system_lyxrc ||
1958 print_file_extension != system_lyxrc.print_file_extension) {
1959 os << "\\print_file_extension \""
1960 << print_file_extension
1967 << "# TEX SECTION #######################################\n"
1970 case RC_FONT_ENCODING:
1971 if (ignore_system_lyxrc ||
1972 fontenc != system_lyxrc.fontenc) {
1973 os << "\\font_encoding \"" << fontenc << "\"\n";
1979 << "# FILE SECTION ######################################\n"
1982 case RC_DOCUMENTPATH:
1983 if (ignore_system_lyxrc ||
1984 document_path != system_lyxrc.document_path) {
1985 string const path = os::external_path(document_path);
1986 os << "\\document_path \"" << path << "\"\n";
1990 case RC_USELASTFILEPOS:
1991 if (ignore_system_lyxrc ||
1992 use_lastfilepos != system_lyxrc.use_lastfilepos) {
1993 os << "\\use_lastfilepos " << convert<string>(use_lastfilepos)
1998 case RC_LOADSESSION:
1999 if (ignore_system_lyxrc ||
2000 load_session != system_lyxrc.load_session) {
2001 os << "\\load_session " << convert<string>(load_session)
2006 case RC_MOUSE_WHEEL_SPEED:
2007 if (ignore_system_lyxrc ||
2008 mouse_wheel_speed != system_lyxrc.mouse_wheel_speed) {
2009 os << "\\mouse_wheel_speed " << mouse_wheel_speed << '\n';
2013 case RC_COMPLETION_INLINE_DELAY:
2014 if (ignore_system_lyxrc ||
2015 completion_inline_delay != system_lyxrc.completion_inline_delay) {
2016 os << "\\completion_inline_delay " << completion_inline_delay << '\n';
2020 case RC_COMPLETION_INLINE_MATH:
2021 if (ignore_system_lyxrc ||
2022 completion_inline_math != system_lyxrc.completion_inline_math) {
2023 os << "\\completion_inline_math "
2024 << convert<string>(completion_inline_math) << '\n';
2028 case RC_COMPLETION_INLINE_TEXT:
2029 if (ignore_system_lyxrc ||
2030 completion_inline_text != system_lyxrc.completion_inline_text) {
2031 os << "\\completion_inline_text "
2032 << convert<string>(completion_inline_text) << '\n';
2036 case RC_COMPLETION_INLINE_DOTS:
2037 if (ignore_system_lyxrc ||
2038 completion_inline_dots != system_lyxrc.completion_inline_dots) {
2039 os << "\\completion_inline_dots "
2040 << convert<string>(completion_inline_dots) << '\n';
2044 case RC_AUTOCORRECTION_MATH:
2045 if (ignore_system_lyxrc ||
2046 autocorrection_math != system_lyxrc.autocorrection_math) {
2047 os << "\\autocorrection_math "
2048 << convert<string>(autocorrection_math) << '\n';
2052 case RC_COMPLETION_POPUP_DELAY:
2053 if (ignore_system_lyxrc ||
2054 completion_popup_delay != system_lyxrc.completion_popup_delay) {
2055 os << "\\completion_popup_delay " << completion_popup_delay << '\n';
2059 case RC_COMPLETION_POPUP_MATH:
2060 if (ignore_system_lyxrc ||
2061 completion_popup_math != system_lyxrc.completion_popup_math) {
2062 os << "\\completion_popup_math "
2063 << convert<string>(completion_popup_math) << '\n';
2067 case RC_COMPLETION_POPUP_TEXT:
2068 if (ignore_system_lyxrc ||
2069 completion_popup_text != system_lyxrc.completion_popup_text) {
2070 os << "\\completion_popup_text "
2071 << convert<string>(completion_popup_text) << '\n';
2075 case RC_COMPLETION_CURSOR_TEXT:
2076 if (ignore_system_lyxrc ||
2077 completion_cursor_text != system_lyxrc.completion_cursor_text) {
2078 os << "\\completion_cursor_text "
2079 << convert<string>(completion_cursor_text) << '\n';
2083 case RC_COMPLETION_POPUP_AFTER_COMPLETE:
2084 if (ignore_system_lyxrc ||
2085 completion_popup_after_complete
2086 != system_lyxrc.completion_popup_after_complete) {
2087 os << "\\completion_popup_after_complete "
2088 << convert<string>(completion_popup_after_complete) << '\n';
2092 case RC_NUMLASTFILES:
2093 if (ignore_system_lyxrc ||
2094 num_lastfiles != system_lyxrc.num_lastfiles) {
2095 os << "\\num_lastfiles " << num_lastfiles << '\n';
2099 case RC_CHECKLASTFILES:
2100 if (ignore_system_lyxrc ||
2101 check_lastfiles != system_lyxrc.check_lastfiles) {
2102 os << "\\check_lastfiles " << convert<string>(check_lastfiles)
2107 case RC_EXAMPLEPATH:
2108 if (ignore_system_lyxrc ||
2109 example_path != system_lyxrc.example_path) {
2110 string const path = os::external_path(example_path);
2111 os << "\\example_path \"" << path << "\"\n";
2115 case RC_TEMPLATEPATH:
2116 if (ignore_system_lyxrc ||
2117 template_path != system_lyxrc.template_path) {
2118 string const path = os::external_path(template_path);
2119 os << "\\template_path \"" << path << "\"\n";
2123 case RC_TEMPDIRPATH:
2124 if (ignore_system_lyxrc ||
2125 tempdir_path != system_lyxrc.tempdir_path) {
2126 string const path = os::external_path(tempdir_path);
2127 os << "\\tempdir_path \"" << path << "\"\n";
2131 case RC_THESAURUSDIRPATH:
2132 if (ignore_system_lyxrc ||
2133 thesaurusdir_path != system_lyxrc.thesaurusdir_path) {
2134 string const path = os::external_path(thesaurusdir_path);
2135 os << "\\thesaurusdir_path \"" << path << "\"\n";
2143 case RC_PLAINTEXT_ROFF_COMMAND: // Obsoleted in 2.0
2146 case RC_PLAINTEXT_LINELEN:
2147 if (ignore_system_lyxrc ||
2148 plaintext_linelen != system_lyxrc.plaintext_linelen) {
2149 os << "\\plaintext_linelen " << plaintext_linelen << '\n';
2153 case RC_MAKE_BACKUP:
2154 if (ignore_system_lyxrc ||
2155 make_backup != system_lyxrc.make_backup) {
2156 os << "\\make_backup " << convert<string>(make_backup) << '\n';
2160 case RC_BACKUPDIR_PATH:
2161 if (ignore_system_lyxrc ||
2162 backupdir_path != system_lyxrc.backupdir_path) {
2163 string const path = os::external_path(backupdir_path);
2164 os << "\\backupdir_path \"" << path << "\"\n";
2170 << "# PLAIN TEXT EXPORT SECTION ##############################\n"
2174 << "# SPELLCHECKER SECTION ##############################\n"
2177 case RC_SPELL_COMMAND:
2178 case RC_USE_SPELL_LIB:
2182 case RC_ACCEPT_COMPOUND:
2183 if (ignore_system_lyxrc ||
2184 spellchecker_accept_compound != system_lyxrc.spellchecker_accept_compound) {
2185 os << "\\accept_compound " << convert<string>(spellchecker_accept_compound)
2190 case RC_USE_ALT_LANG:
2195 if (ignore_system_lyxrc ||
2196 spellchecker_alt_lang != system_lyxrc.spellchecker_alt_lang) {
2197 os << "\\alternate_language \"" << spellchecker_alt_lang
2202 case RC_USE_ESC_CHARS:
2206 if (ignore_system_lyxrc ||
2207 spellchecker_esc_chars != system_lyxrc.spellchecker_esc_chars) {
2208 os << "\\escape_chars \"" << spellchecker_esc_chars << "\"\n";
2212 case RC_USE_PERS_DICT:
2216 case RC_USE_TOOLTIP:
2217 if (ignore_system_lyxrc ||
2218 use_tooltip != system_lyxrc.use_tooltip) {
2219 os << "\\use_tooltip "
2220 << convert<string>(use_tooltip)
2225 case RC_USE_PIXMAP_CACHE:
2226 if (ignore_system_lyxrc ||
2227 use_pixmap_cache != system_lyxrc.use_pixmap_cache) {
2228 os << "\\use_pixmap_cache "
2229 << convert<string>(use_pixmap_cache)
2238 case RC_USE_INP_ENC:
2244 << "# LANGUAGE SUPPORT SECTION ##########################\n"
2249 case RC_SPELLCHECK_CONTINUOUSLY:
2250 if (ignore_system_lyxrc ||
2251 spellcheck_continuously != system_lyxrc.spellcheck_continuously) {
2252 os << "\\spellcheck_continuously " << convert<string>(spellcheck_continuously)
2258 case RC_RTL_SUPPORT:
2259 if (ignore_system_lyxrc ||
2260 rtl_support != system_lyxrc.rtl_support) {
2261 os << "\\rtl " << convert<string>(rtl_support) << '\n';
2265 case RC_VISUAL_CURSOR:
2266 if (ignore_system_lyxrc ||
2267 visual_cursor != system_lyxrc.visual_cursor) {
2268 os << "\\visual_cursor " << convert<string>(visual_cursor) << '\n';
2272 case RC_LANGUAGE_PACKAGE:
2273 if (ignore_system_lyxrc ||
2274 language_package != system_lyxrc.language_package) {
2275 os << "\\language_package \"" << language_package
2280 case RC_LANGUAGE_GLOBAL_OPTIONS:
2281 if (ignore_system_lyxrc ||
2282 language_global_options
2283 != system_lyxrc.language_global_options) {
2284 os << "\\language_global_options \""
2285 << convert<string>(language_global_options)
2290 case RC_LANGUAGE_USE_BABEL:
2291 if (ignore_system_lyxrc ||
2292 language_use_babel != system_lyxrc.language_use_babel) {
2293 os << "\\language_use_babel \""
2294 << convert<string>(language_use_babel)
2299 case RC_LANGUAGE_COMMAND_BEGIN:
2300 if (ignore_system_lyxrc ||
2301 language_command_begin
2302 != system_lyxrc.language_command_begin) {
2303 os << "\\language_command_begin \""
2304 << language_command_begin
2309 case RC_LANGUAGE_COMMAND_END:
2310 if (ignore_system_lyxrc ||
2311 language_command_end
2312 != system_lyxrc.language_command_end) {
2313 os << "\\language_command_end \"" << language_command_end
2318 case RC_LANGUAGE_COMMAND_LOCAL:
2319 if (ignore_system_lyxrc ||
2320 language_command_local
2321 != system_lyxrc.language_command_local) {
2322 os << "\\language_command_local \""
2323 << language_command_local
2328 case RC_LANGUAGE_AUTO_BEGIN:
2329 if (ignore_system_lyxrc ||
2330 language_auto_begin != system_lyxrc.language_auto_begin) {
2331 os << "\\language_auto_begin "
2332 << convert<string>(language_auto_begin) << '\n';
2336 case RC_LANGUAGE_AUTO_END:
2337 if (ignore_system_lyxrc ||
2338 language_auto_end != system_lyxrc.language_auto_end) {
2339 os << "\\language_auto_end "
2340 << convert<string>(language_auto_end) << '\n';
2344 case RC_MARK_FOREIGN_LANGUAGE:
2345 if (ignore_system_lyxrc ||
2346 mark_foreign_language
2347 != system_lyxrc.mark_foreign_language) {
2348 os << "\\mark_foreign_language " <<
2349 convert<string>(mark_foreign_language) << '\n';
2355 << "# 2nd MISC SUPPORT SECTION ##########################\n"
2358 case RC_AUTO_NUMBER:
2359 if (ignore_system_lyxrc ||
2360 auto_number != system_lyxrc.auto_number) {
2361 os << "\\auto_number " << convert<string>(auto_number) << '\n';
2365 case RC_DEFAULT_LANGUAGE:
2366 if (ignore_system_lyxrc ||
2367 default_language != system_lyxrc.default_language) {
2368 os << "\\default_language " << default_language << '\n';
2372 case RC_GUI_LANGUAGE:
2373 if (ignore_system_lyxrc ||
2374 gui_language != system_lyxrc.gui_language) {
2375 os << "\\gui_language " << gui_language << '\n';
2381 << "# FORMATS SECTION ##########################\n"
2385 // New/modified formats
2386 for (Formats::const_iterator cit = formats.begin();
2387 cit != formats.end(); ++cit) {
2388 Format const * format =
2389 system_formats.getFormat(cit->name());
2391 format->extension() != cit->extension() ||
2392 format->prettyname() != cit->prettyname() ||
2393 format->shortcut() != cit->shortcut() ||
2394 format->viewer() != cit->viewer() ||
2395 format->editor() != cit->editor() ||
2396 format->documentFormat() != cit->documentFormat() ||
2397 format->vectorFormat() != cit->vectorFormat()) {
2398 os << "\\format \"" << cit->name() << "\" \""
2399 << cit->extension() << "\" \""
2400 << cit->prettyname() << "\" \""
2401 << cit->shortcut() << "\" \""
2402 << escapeCommand(cit->viewer()) << "\" \""
2403 << escapeCommand(cit->editor()) << "\" \"";
2404 vector<string> flags;
2405 if (cit->documentFormat())
2406 flags.push_back("document");
2407 if (cit->vectorFormat())
2408 flags.push_back("vector");
2409 os << getStringFromVector(flags);
2414 // Look for deleted formats
2415 for (Formats::const_iterator cit = system_formats.begin();
2416 cit != system_formats.end(); ++cit)
2417 if (!formats.getFormat(cit->name()))
2418 os << "\\format \"" << cit->name()
2419 << "\" \"\" \"\" \"\" \"\" \"\" \"\"\n";
2422 case RC_DEFAULT_VIEW_FORMAT:
2423 if (ignore_system_lyxrc ||
2424 default_view_format != system_lyxrc.default_view_format) {
2425 os << "\\default_view_format " << default_view_format << '\n';
2435 << "# CONVERTERS SECTION ##########################\n"
2439 // Look for new converters
2440 for (Converters::const_iterator cit = theConverters().begin();
2441 cit != theConverters().end(); ++cit) {
2442 Converter const * converter =
2443 theSystemConverters().getConverter(cit->from,
2446 converter->command != cit->command ||
2447 converter->flags != cit->flags)
2448 os << "\\converter \"" << cit->from << "\" \""
2449 << cit->to << "\" \""
2450 << escapeCommand(cit->command) << "\" \""
2451 << cit->flags << "\"\n";
2454 // New/modifed converters
2455 for (Converters::const_iterator cit = theSystemConverters().begin();
2456 cit != theSystemConverters().end(); ++cit)
2457 if (!theConverters().getConverter(cit->from, cit->to))
2458 os << "\\converter \"" << cit->from
2459 << "\" \"" << cit->to << "\" \"\" \"\"\n";
2466 << "# COPIERS SECTION ##########################\n"
2469 // Look for new movers
2470 Movers::const_iterator const sysbegin = theSystemMovers().begin();
2471 Movers::const_iterator const sysend = theSystemMovers().end();
2472 Movers::const_iterator it = theMovers().begin();
2473 Movers::const_iterator end = theMovers().end();
2475 for (; it != end; ++it) {
2476 Movers::const_iterator const sysit =
2477 find_if(sysbegin, sysend, SameMover(*it));
2478 if (sysit == sysend) {
2479 string const & fmt = it->first;
2480 string const & command =
2481 it->second.command();
2483 os << "\\copier " << fmt
2484 << " \"" << escapeCommand(command) << "\"\n";
2490 // We don't actually delete SpecialisedMover(s) from the
2491 // map, just clear their 'command', so there's no need
2492 // to test for anything else.
2500 string const LyXRC::getDescription(LyXRCTags tag)
2505 case RC_ACCEPT_COMPOUND:
2506 str = _("Consider run-together words, such as \"diskdrive\" for \"disk drive\", as legal words?");
2510 case RC_USE_ALT_LANG:
2511 str = _("Specify an alternate language. The default is to use the language of the document.");
2514 case RC_PLAINTEXT_ROFF_COMMAND:
2515 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.");
2518 case RC_PLAINTEXT_LINELEN:
2519 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.");
2522 case RC_AUTOREGIONDELETE:
2523 str = _("De-select if you don't want the current selection to be replaced automatically by what you type.");
2526 case RC_AUTORESET_OPTIONS:
2527 str = _("De-select if you don't want the class options to be reset to defaults after class change.");
2531 str = _("The time interval between auto-saves (in seconds). 0 means no auto-save.");
2534 case RC_AUTO_NUMBER:
2537 case RC_BACKUPDIR_PATH:
2538 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.");
2541 case RC_BIBTEX_COMMAND:
2542 str = _("Define the options of bibtex (cf. man bibtex) or select an alternative compiler (e.g. mlbibtex or bibulus).");
2545 case RC_JBIBTEX_COMMAND:
2546 str = _("Define the options of the bibtex program for PLaTeX (Japanese LaTeX).");
2550 str = _("Keybindings file. Can either specify an absolute path, or LyX will look in its global and local bind/ directories.");
2553 case RC_CHECKLASTFILES:
2554 str = _("Select to check whether the lastfiles still exist.");
2557 case RC_CHKTEX_COMMAND:
2558 str = _("Define how to run chktex. E.g. \"chktex -n11 -n1 -n3 -n6 -n9 -22 -n25 -n30 -n38\" Refer to the ChkTeX documentation.");
2567 case RC_CURSOR_FOLLOWS_SCROLLBAR:
2568 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.");
2571 case RC_SCROLL_BELOW_DOCUMENT:
2572 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");
2575 case RC_MAC_LIKE_WORD_MOVEMENT:
2576 str = _("Use the Mac OS X conventions for the word-level cursor movement");
2579 case RC_SHOW_MACRO_LABEL:
2580 str = _("Show a small box around a Math Macro with the macro name when the cursor is inside.");
2583 case RC_DATE_INSERT_FORMAT:
2584 //xgettext:no-c-format
2585 str = _("This accepts the normal strftime formats; see man strftime for full details. E.g.\"%A, %e. %B %Y\".");
2589 str = _("Command definition file. Can either specify an absolute path, or LyX will look in its global and local commands/ directories.");
2592 case RC_DEFAULT_VIEW_FORMAT:
2593 str = _("The default format used with LFUN_BUFFER_[VIEW|UPDATE].");
2596 case RC_DEFAULT_LANGUAGE:
2597 str = _("New documents will be assigned this language.");
2600 case RC_DEFAULT_PAPERSIZE:
2601 str = _("Specify the default paper size.");
2604 case RC_DIALOGS_ICONIFY_WITH_MAIN:
2605 str = _("Iconify the dialogs when the main window is iconified. (Affects only dialogs shown after the change has been made.)");
2608 case RC_DISPLAY_GRAPHICS:
2609 str = _("Select how LyX will display any graphics.");
2612 case RC_DOCUMENTPATH:
2613 str = _("The default path for your documents. An empty value selects the directory LyX was started from.");
2617 case RC_USE_ESC_CHARS:
2618 str = _("Specify additional chars that can be part of a word.");
2621 case RC_EXAMPLEPATH:
2622 str = _("The path that LyX will set when offering to choose an example. An empty value selects the directory LyX was started from.");
2625 case RC_FONT_ENCODING:
2626 str = _("The font encoding used for the LaTeX2e fontenc package. T1 is highly recommended for non-English languages.");
2632 case RC_INDEX_COMMAND:
2633 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\".");
2636 case RC_JINDEX_COMMAND:
2637 str = _("Define the options of the index program for PLaTeX (Japanese LaTeX).");
2640 case RC_NOMENCL_COMMAND:
2641 str = _("Define the options of makeindex (cf. man makeindex) to be used for nomenclatures. This might differ from the index processing options.");
2648 case RC_KBMAP_PRIMARY:
2649 case RC_KBMAP_SECONDARY:
2650 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.");
2653 case RC_LABEL_INIT_LENGTH:
2654 str = _("Maximum number of words in the initialization string for a new label");
2657 case RC_LANGUAGE_AUTO_BEGIN:
2658 str = _("Select if a language switching command is needed at the beginning of the document.");
2661 case RC_LANGUAGE_AUTO_END:
2662 str = _("Select if a language switching command is needed at the end of the document.");
2665 case RC_LANGUAGE_COMMAND_BEGIN:
2666 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.");
2669 case RC_LANGUAGE_COMMAND_END:
2670 str = _("The LaTeX command for changing back to the language of the document.");
2673 case RC_LANGUAGE_COMMAND_LOCAL:
2674 str = _("The LaTeX command for local changing of the language.");
2677 case RC_LANGUAGE_GLOBAL_OPTIONS:
2678 str = _("De-select if you don't want the language(s) used as an argument to \\documentclass.");
2681 case RC_LANGUAGE_PACKAGE:
2682 str = _("The LaTeX command for loading the language package. E.g. \"\\usepackage{babel}\", \"\\usepackage{omega}\".");
2685 case RC_LANGUAGE_USE_BABEL:
2686 str = _("De-select if you don't want babel to be used when the language of the document is the default language.");
2689 case RC_USELASTFILEPOS:
2690 str = _("De-select if you do not want LyX to scroll to saved position.");
2693 case RC_LOADSESSION:
2694 str = _("De-select to prevent loading files opened from the last LyX session.");
2697 case RC_MAKE_BACKUP:
2698 str = _("De-select if you don't want LyX to create backup files.");
2701 case RC_MARK_FOREIGN_LANGUAGE:
2702 str = _("Select to control the highlighting of words with a language foreign to that of the document.");
2705 case RC_MOUSE_WHEEL_SPEED:
2706 str = bformat(_("The scrolling speed of the mouse wheel."),
2710 case RC_COMPLETION_POPUP_DELAY:
2711 str = _("The completion popup delay.");
2714 case RC_COMPLETION_POPUP_MATH:
2715 str = _("Select to display the completion popup in math mode.");
2718 case RC_COMPLETION_POPUP_TEXT:
2719 str = _("Select to display the completion popup in text mode.");
2722 case RC_COMPLETION_POPUP_AFTER_COMPLETE:
2723 str = _("Show the completion popup without delay after non-unique completion attempt.");
2726 case RC_COMPLETION_POPUP_TEXT:
2727 str = _("Show a small triangle on the cursor to indicate that a completion is available.");
2730 case RC_COMPLETION_POPUP_DELAY:
2731 str = _("The inline completion delay.");
2734 case RC_COMPLETION_INLINE_MATH:
2735 str = _("Select to display the inline completion in math mode.");
2738 case RC_COMPLETION_INLINE_TEXT:
2739 str = _("Select to display the inline completion in text mode.");
2742 case RC_COMPLETION_INLINE_DOTS:
2743 str = _("Use \"...\" to shorten long completions.");
2746 case RC_AUTOCORRECTION_MATH:
2747 str = _("Allow TeXMacs shorthand, like => converting to \Rightarrow.");
2750 case RC_NUMLASTFILES:
2751 str = bformat(_("Maximal number of lastfiles. Up to %1$d can appear in the file menu."),
2755 case RC_PATH_PREFIX:
2756 str = _("Specify those directories which should be "
2757 "prepended to the PATH environment variable. "
2758 "Use the OS native format.");
2762 str = _("Shows a typeset preview of things such as math");
2765 case RC_PREVIEW_HASHED_LABELS:
2766 str = _("Previewed equations will have \"(#)\" labels rather than numbered ones");
2769 case RC_PREVIEW_SCALE_FACTOR:
2770 str = _("Scale the preview size to suit.");
2773 case RC_PRINTCOLLCOPIESFLAG:
2774 str = _("The option for specifying whether the copies should be collated.");
2777 case RC_PRINTCOPIESFLAG:
2778 str = _("The option for specifying the number of copies to print.");
2782 str = _("The default printer to print on. If none is specified, LyX will use the environment variable PRINTER.");
2785 case RC_PRINTEVENPAGEFLAG:
2786 str = _("The option to print only even pages.");
2789 case RC_PRINTEXSTRAOPTIONS:
2790 str = _("Extra options to pass to printing program after everything else, but before the filename of the DVI file to be printed.");
2793 case RC_PRINTFILEEXTENSION:
2794 str = _("Extension of printer program output file. Usually \".ps\".");
2797 case RC_PRINTLANDSCAPEFLAG:
2798 str = _("The option to print out in landscape.");
2801 case RC_PRINTODDPAGEFLAG:
2802 str = _("The option to print only odd pages.");
2805 case RC_PRINTPAGERANGEFLAG:
2806 str = _("The option for specifying a comma-separated list of pages to print.");
2809 case RC_PRINTPAPERDIMENSIONFLAG:
2810 str = _("Option to specify the dimensions of the print paper.");
2813 case RC_PRINTPAPERFLAG:
2814 str = _("The option to specify paper type.");
2817 case RC_PRINTREVERSEFLAG:
2818 str = _("The option to reverse the order of the pages printed.");
2821 case RC_PRINTSPOOL_COMMAND:
2822 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.");
2825 case RC_PRINTSPOOL_PRINTERPREFIX:
2826 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.");
2829 case RC_PRINTTOFILE:
2830 str = _("Option to pass to the print program to print to a file.");
2833 case RC_PRINTTOPRINTER:
2834 str = _("Option to pass to the print program to print on a specific printer.");
2837 case RC_PRINT_ADAPTOUTPUT:
2838 str = _("Select for LyX to pass the name of the destination printer to your print command.");
2841 case RC_PRINT_COMMAND:
2842 str = _("Your favorite print program, e.g. \"dvips\", \"dvilj4\".");
2845 case RC_RTL_SUPPORT:
2846 str = _("Select to enable support of right-to-left languages (e.g. Hebrew, Arabic).");
2849 case RC_VISUAL_CURSOR:
2850 str = _("Select to have visual bidi cursor movement, unselect for logical movement.");
2854 str = _("DPI (dots per inch) of your monitor is auto-detected by LyX. If that goes wrong, override the setting here.");
2857 case RC_SCREEN_FONT_ROMAN:
2858 case RC_SCREEN_FONT_SANS:
2859 case RC_SCREEN_FONT_TYPEWRITER:
2860 str = _("The screen fonts used to display the text while editing.");
2863 case RC_SCREEN_FONT_ROMAN_FOUNDRY:
2864 case RC_SCREEN_FONT_SANS_FOUNDRY:
2865 case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
2868 case RC_SCREEN_FONT_SCALABLE:
2869 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.");
2872 case RC_SCREEN_FONT_SIZES:
2873 str = _("The font sizes used for calculating the scaling of the screen fonts.");
2876 case RC_SCREEN_ZOOM:
2877 //xgettext:no-c-format
2878 str = _("The zoom percentage for screen fonts. A setting of 100% will make the fonts roughly the same size as on paper.");
2881 case RC_GEOMETRY_SESSION:
2882 str = _("Allow session manager to save and restore windows geometry.");
2886 str = _("This starts the lyxserver. The pipes get an additional extension \".in\" and \".out\". Only for advanced users.");
2892 case RC_SHOW_BANNER:
2893 str = _("De-select if you don't want the startup banner.");
2896 case RC_TEMPDIRPATH:
2897 str = _("LyX will place its temporary directories in this path. They will be deleted when you quit LyX.");
2900 case RC_THESAURUSDIRPATH:
2901 str = _("This is the place where the files of the thesaurus library reside.");
2904 case RC_TEMPLATEPATH:
2905 str = _("The path that LyX will set when offering to choose a template. An empty value selects the directory LyX was started from.");
2908 case RC_TEX_ALLOWS_SPACES:
2911 case RC_TEX_EXPECTS_WINDOWS_PATHS:
2915 str = _("The UI (user interface) file. Can either specify an absolute path, or LyX will look in its global and local ui/ directories.");
2927 case RC_USE_TOOLTIP:
2928 str = _("Enable the automatic appearance of tool tips in the work area.");
2931 case RC_USE_PIXMAP_CACHE:
2932 str = _("Enable the pixmap cache that might improve performance on Mac and Windows.");
2935 case RC_USE_SPELL_LIB:
2938 case RC_VIEWDVI_PAPEROPTION:
2939 _("Specify the paper command to DVI viewer (leave empty or use \"-paper\")");
2954 // The global instance
2957 // The global copy of the system lyxrc entries (everything except preferences)