enhance debug message.
[lyx.git] / src / LyXRC.cpp
blob0de230eccbb62d00e480b5fdfc774f073107b72b
1 /**
2 * \file LyXRC.cpp
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
9 * \author John Levon
10 * \author André Pönitz
11 * \author Allan Rae
12 * \author Dekel Tsur
14 * Full author contact details are available in file CREDITS.
17 #include <config.h>
19 #include "LyXRC.h"
21 #include "ColorSet.h"
22 #include "Converter.h"
23 #include "FontEnums.h"
24 #include "Format.h"
25 #include "Lexer.h"
26 #include "Mover.h"
27 #include "Session.h"
28 #include "version.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"
41 #include <fstream>
42 #include <iostream>
44 using namespace std;
45 using namespace lyx::support;
47 namespace lyx {
49 namespace os = support::os;
51 namespace {
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 { "\\hunspelldir_path", LyXRC::RC_HUNSPELLDIR_PATH },
103 { "\\index_alternatives", LyXRC::RC_INDEX_ALTERNATIVES },
104 { "\\index_command", LyXRC::RC_INDEX_COMMAND },
105 { "\\input", LyXRC::RC_INPUT },
106 { "\\jbibtex_command", LyXRC::RC_JBIBTEX_COMMAND },
107 { "\\jindex_command", LyXRC::RC_JINDEX_COMMAND },
108 { "\\kbmap", LyXRC::RC_KBMAP },
109 { "\\kbmap_primary", LyXRC::RC_KBMAP_PRIMARY },
110 { "\\kbmap_secondary", LyXRC::RC_KBMAP_SECONDARY },
111 { "\\label_init_length", LyXRC::RC_LABEL_INIT_LENGTH },
112 { "\\language_auto_begin", LyXRC::RC_LANGUAGE_AUTO_BEGIN },
113 { "\\language_auto_end", LyXRC::RC_LANGUAGE_AUTO_END },
114 { "\\language_command_begin", LyXRC::RC_LANGUAGE_COMMAND_BEGIN },
115 { "\\language_command_end", LyXRC::RC_LANGUAGE_COMMAND_END },
116 { "\\language_command_local", LyXRC::RC_LANGUAGE_COMMAND_LOCAL },
117 { "\\language_global_options", LyXRC::RC_LANGUAGE_GLOBAL_OPTIONS },
118 { "\\language_package", LyXRC::RC_LANGUAGE_PACKAGE },
119 { "\\language_use_babel", LyXRC::RC_LANGUAGE_USE_BABEL },
120 { "\\load_session", LyXRC::RC_LOADSESSION },
121 { "\\mac_like_word_movement", LyXRC::RC_MAC_LIKE_WORD_MOVEMENT },
122 { "\\macro_edit_style", LyXRC::RC_MACRO_EDIT_STYLE },
123 { "\\make_backup", LyXRC::RC_MAKE_BACKUP },
124 { "\\mark_foreign_language", LyXRC::RC_MARK_FOREIGN_LANGUAGE },
125 { "\\mouse_wheel_speed", LyXRC::RC_MOUSE_WHEEL_SPEED },
126 { "\\nomencl_command", LyXRC::RC_NOMENCL_COMMAND },
127 { "\\num_lastfiles", LyXRC::RC_NUMLASTFILES },
128 { "\\open_buffers_in_tabs", LyXRC::RC_OPEN_BUFFERS_IN_TABS },
129 { "\\path_prefix", LyXRC::RC_PATH_PREFIX },
130 { "\\personal_dictionary", LyXRC::RC_PERS_DICT },
131 { "\\plaintext_linelen", LyXRC::RC_PLAINTEXT_LINELEN },
132 { "\\plaintext_roff_command", LyXRC::RC_PLAINTEXT_ROFF_COMMAND },
133 { "\\preview", LyXRC::RC_PREVIEW },
134 { "\\preview_hashed_labels", LyXRC::RC_PREVIEW_HASHED_LABELS },
135 { "\\preview_scale_factor", LyXRC::RC_PREVIEW_SCALE_FACTOR },
136 { "\\print_adapt_output", LyXRC::RC_PRINT_ADAPTOUTPUT },
137 { "\\print_collcopies_flag", LyXRC::RC_PRINTCOLLCOPIESFLAG },
138 { "\\print_command", LyXRC::RC_PRINT_COMMAND },
139 { "\\print_copies_flag", LyXRC::RC_PRINTCOPIESFLAG },
140 { "\\print_evenpage_flag", LyXRC::RC_PRINTEVENPAGEFLAG },
141 { "\\print_extra_options", LyXRC::RC_PRINTEXSTRAOPTIONS },
142 { "\\print_file_extension", LyXRC::RC_PRINTFILEEXTENSION },
143 { "\\print_landscape_flag", LyXRC::RC_PRINTLANDSCAPEFLAG },
144 { "\\print_oddpage_flag", LyXRC::RC_PRINTODDPAGEFLAG },
145 { "\\print_pagerange_flag", LyXRC::RC_PRINTPAGERANGEFLAG },
146 { "\\print_paper_dimension_flag", LyXRC::RC_PRINTPAPERDIMENSIONFLAG },
147 { "\\print_paper_flag", LyXRC::RC_PRINTPAPERFLAG },
148 { "\\print_reverse_flag", LyXRC::RC_PRINTREVERSEFLAG },
149 { "\\print_spool_command", LyXRC::RC_PRINTSPOOL_COMMAND },
150 { "\\print_spool_printerprefix", LyXRC::RC_PRINTSPOOL_PRINTERPREFIX },
151 { "\\print_to_file", LyXRC::RC_PRINTTOFILE },
152 { "\\print_to_printer", LyXRC::RC_PRINTTOPRINTER },
153 { "\\printer", LyXRC::RC_PRINTER },
154 { "\\rtl", LyXRC::RC_RTL_SUPPORT },
155 { "\\screen_dpi", LyXRC::RC_SCREEN_DPI },
156 { "\\screen_font_roman", LyXRC::RC_SCREEN_FONT_ROMAN },
157 { "\\screen_font_roman_foundry", LyXRC::RC_SCREEN_FONT_ROMAN_FOUNDRY },
158 { "\\screen_font_sans", LyXRC::RC_SCREEN_FONT_SANS },
159 { "\\screen_font_sans_foundry", LyXRC::RC_SCREEN_FONT_SANS_FOUNDRY },
160 { "\\screen_font_scalable", LyXRC::RC_SCREEN_FONT_SCALABLE },
161 { "\\screen_font_sizes", LyXRC::RC_SCREEN_FONT_SIZES },
162 { "\\screen_font_typewriter", LyXRC::RC_SCREEN_FONT_TYPEWRITER },
163 { "\\screen_font_typewriter_foundry", LyXRC::RC_SCREEN_FONT_TYPEWRITER_FOUNDRY },
164 { "\\screen_zoom", LyXRC::RC_SCREEN_ZOOM },
165 { "\\scroll_below_document", LyXRC::RC_SCROLL_BELOW_DOCUMENT },
166 { "\\serverpipe", LyXRC::RC_SERVERPIPE },
167 { "\\set_color", LyXRC::RC_SET_COLOR },
168 { "\\show_banner", LyXRC::RC_SHOW_BANNER },
169 { "\\sort_layouts", LyXRC::RC_SORT_LAYOUTS },
170 { "\\spell_command", LyXRC::RC_SPELL_COMMAND },
171 { "\\spellcheck_continuously", LyXRC::RC_SPELLCHECK_CONTINUOUSLY },
172 { "\\spellchecker", LyXRC::RC_SPELLCHECKER },
173 { "\\splitindex_command", LyXRC::RC_SPLITINDEX_COMMAND },
174 { "\\tempdir_path", LyXRC::RC_TEMPDIRPATH },
175 { "\\template_path", LyXRC::RC_TEMPLATEPATH },
176 { "\\tex_allows_spaces", LyXRC::RC_TEX_ALLOWS_SPACES },
177 { "\\tex_expects_windows_paths", LyXRC::RC_TEX_EXPECTS_WINDOWS_PATHS },
178 { "\\thesaurusdir_path", LyXRC::RC_THESAURUSDIRPATH },
179 { "\\ui_file", LyXRC::RC_UIFILE },
180 { "\\use_alt_language", LyXRC::RC_USE_ALT_LANG },
181 { "\\use_converter_cache", LyXRC::RC_USE_CONVERTER_CACHE },
182 { "\\use_escape_chars", LyXRC::RC_USE_ESC_CHARS },
183 { "\\use_input_encoding", LyXRC::RC_USE_INP_ENC },
184 { "\\use_lastfilepos", LyXRC::RC_USELASTFILEPOS },
185 { "\\use_personal_dictionary", LyXRC::RC_USE_PERS_DICT },
186 { "\\use_pixmap_cache", LyXRC::RC_USE_PIXMAP_CACHE },
187 // compatibility with versions older than 1.4.0 only
188 { "\\use_pspell", LyXRC::RC_USE_SPELL_LIB },
189 // compatibility with versions older than 1.4.0 only
190 { "\\use_tempdir", LyXRC::RC_USETEMPDIR },
191 { "\\use_tooltip", LyXRC::RC_USE_TOOLTIP },
192 { "\\user_email", LyXRC::RC_USER_EMAIL },
193 { "\\user_name", LyXRC::RC_USER_NAME },
194 { "\\view_dvi_paper_option", LyXRC::RC_VIEWDVI_PAPEROPTION },
195 // compatibility with versions older than 1.4.0 only
196 { "\\viewer", LyXRC::RC_VIEWER},
197 { "\\visual_cursor" ,LyXRC::RC_VISUAL_CURSOR}
200 const int lyxrcCount = sizeof(lyxrcTags) / sizeof(lyxrcTags[0]);
202 } // namespace anon
205 LyXRC::LyXRC()
207 setDefaults();
211 void LyXRC::setDefaults()
213 bind_file = "cua";
214 def_file = "default";
215 ui_file = "default";
216 // Get printer from the environment. If fail, use default "",
217 // assuming that everything is set up correctly.
218 printer = getEnv("PRINTER");
219 print_adapt_output = false;
220 print_command = "dvips";
221 print_evenpage_flag = "-B";
222 print_oddpage_flag = "-A";
223 print_pagerange_flag = "-pp";
224 print_copies_flag = "-c";
225 print_collcopies_flag = "-C";
226 print_reverse_flag = "-r";
227 print_landscape_flag = "-t landscape";
228 print_to_printer = "-P";
229 print_to_file = "-o ";
230 print_file_extension = ".ps";
231 print_paper_flag = "-t";
232 print_paper_dimension_flag = "-T";
233 document_path.erase();
234 view_dvi_paper_option.erase();
235 default_papersize = PAPER_DEFAULT;
236 default_view_format = "pdf2";
237 chktex_command = "chktex -n1 -n3 -n6 -n9 -n22 -n25 -n30 -n38";
238 bibtex_command = "bibtex";
239 fontenc = "default";
240 index_command = "makeindex -c -q";
241 nomencl_command = "makeindex -s nomencl.ist";
242 dpi = 75;
243 // Because a screen typically is wider than a piece of paper:
244 zoom = 150;
245 allow_geometry_session = true;
246 // Default LaTeX font size:
247 font_sizes[FONT_SIZE_TINY] = "5.0";
248 font_sizes[FONT_SIZE_SCRIPT] = "7.0";
249 font_sizes[FONT_SIZE_FOOTNOTE] = "8.0";
250 font_sizes[FONT_SIZE_SMALL] = "9.0";
251 font_sizes[FONT_SIZE_NORMAL] = "10.0";
252 font_sizes[FONT_SIZE_LARGE] = "12.0";
253 font_sizes[FONT_SIZE_LARGER] = "14.4";
254 font_sizes[FONT_SIZE_LARGEST] = "17.26";
255 font_sizes[FONT_SIZE_HUGE] = "20.74";
256 font_sizes[FONT_SIZE_HUGER] = "24.88";
257 use_scalable_fonts = true;
258 roman_font_name = "";
259 sans_font_name = "";
260 typewriter_font_name = "";
261 autosave = 300;
262 auto_region_delete = true;
263 auto_reset_options = false;
264 plaintext_linelen = 65;
265 mouse_wheel_speed = 1.0;
266 num_lastfiles = maxlastfiles;
267 check_lastfiles = true;
268 use_lastfilepos = true;
269 load_session = false;
270 make_backup = true;
271 backupdir_path.erase();
272 display_graphics = true;
273 // Spellchecker settings:
274 spellchecker = "aspell";
275 spellchecker_accept_compound = false;
276 spellcheck_continuously = false;
277 use_kbmap = false;
278 rtl_support = true;
279 visual_cursor = false;
280 auto_number = true;
281 mark_foreign_language = true;
282 language_auto_begin = true;
283 language_auto_end = true;
284 language_global_options = true;
285 language_use_babel = true;
286 language_package = "\\usepackage{babel}";
287 language_command_begin = "\\selectlanguage{$$lang}";
288 language_command_local = "\\foreignlanguage{$$lang}{";
289 sort_layouts = false;
290 group_layouts = true;
291 default_language = "english";
292 gui_language = "auto";
293 show_banner = true;
294 windows_style_tex_paths = false;
295 tex_allows_spaces = false;
296 date_insert_format = "%x";
297 cursor_follows_scrollbar = false;
298 scroll_below_document = false;
299 mac_like_word_movement = false;
300 macro_edit_style = MACRO_EDIT_INLINE_BOX;
301 dialogs_iconify_with_main = false;
302 label_init_length = 3;
303 preview = PREVIEW_OFF;
304 preview_hashed_labels = false;
305 preview_scale_factor = "0.9";
306 use_converter_cache = true;
307 use_tooltip = true;
308 use_pixmap_cache = false;
309 converter_cache_maxage = 6 * 30 * 24 * 3600; // 6 months
310 user_name = to_utf8(support::user_name());
311 user_email = to_utf8(support::user_email());
312 open_buffers_in_tabs = true;
314 // Fullscreen settings
315 full_screen_limit = false;
316 full_screen_toolbars = true;
317 full_screen_tabbar = true;
318 full_screen_menubar = true;
319 full_screen_scrollbar = true;
320 full_screen_width = 700;
322 completion_cursor_text = true;
323 completion_popup_math = true;
324 completion_popup_text = false;
325 completion_popup_delay = 2.0;
326 completion_popup_after_complete = true;
327 autocorrection_math = false;
328 completion_inline_math = true;
329 completion_inline_text = false;
330 completion_inline_dots = -1;
331 completion_inline_delay = 0.2;
335 namespace {
337 void oldFontFormat(string & family, string & foundry)
339 if (family.empty() || family[0] != '-')
340 return;
341 foundry = token(family, '-', 1);
342 family = token(family, '-', 2);
343 if (foundry == "*")
344 foundry.erase();
347 } // namespace anon
350 int LyXRC::read(FileName const & filename)
352 Lexer lexrc(lyxrcTags);
353 if (lyxerr.debugging(Debug::PARSER))
354 lexrc.printTable(lyxerr);
356 lexrc.setFile(filename);
357 if (!lexrc.isOK())
358 return -2;
360 LYXERR(Debug::LYXRC, "Reading '" << filename << "'...");
362 return read(lexrc);
366 int LyXRC::read(istream & is)
368 Lexer lexrc(lyxrcTags);
369 if (lyxerr.debugging(Debug::PARSER))
370 lexrc.printTable(lyxerr);
372 lexrc.setStream(is);
373 if (!lexrc.isOK())
374 return -2;
376 LYXERR(Debug::LYXRC, "Reading istream...");
378 return read(lexrc);
382 int LyXRC::read(Lexer & lexrc)
384 if (!lexrc.isOK())
385 return -2;
387 while (lexrc.isOK()) {
388 // By using two switches we take advantage of the compiler
389 // telling us if we have missed a LyXRCTags element in
390 // the second switch.
391 // Note that this also shows a problem with Lexer since it
392 // helps us avoid taking advantage of the strictness of the
393 // compiler.
395 int le = lexrc.lex();
396 switch (le) {
397 case Lexer::LEX_UNDEF:
398 lexrc.printError("Unknown tag `$$Token'");
399 continue;
400 case Lexer::LEX_FEOF:
401 continue;
402 default:
403 break;
405 switch (static_cast<LyXRCTags>(le)) {
406 case RC_INPUT: // Include file
407 if (lexrc.next()) {
408 FileName const tmp =
409 libFileSearch(string(),
410 lexrc.getString());
411 if (read(tmp)) {
412 lexrc.printError("Error reading "
413 "included file: " + tmp.absFilename());
416 break;
417 case RC_BINDFILE:
418 if (lexrc.next())
419 bind_file = os::internal_path(lexrc.getString());
420 break;
422 case RC_DEFFILE:
423 if (lexrc.next())
424 def_file = os::internal_path(lexrc.getString());
425 break;
427 case RC_UIFILE:
428 if (lexrc.next())
429 ui_file = os::internal_path(lexrc.getString());
430 break;
432 case RC_AUTORESET_OPTIONS:
433 lexrc >> auto_reset_options;
434 break;
436 case RC_DISPLAY_GRAPHICS:
437 if (lexrc.next())
438 display_graphics = lexrc.getString() == "true";
439 break;
441 case RC_TEX_EXPECTS_WINDOWS_PATHS:
442 lexrc >> windows_style_tex_paths;
443 break;
445 case RC_TEX_ALLOWS_SPACES:
446 lexrc >> tex_allows_spaces;
447 break;
449 case RC_KBMAP:
450 lexrc >> use_kbmap;
451 break;
453 case RC_KBMAP_PRIMARY:
454 if (lexrc.next()) {
455 string const kmap(os::internal_path(lexrc.getString()));
456 if (!libFileSearch("kbd", kmap, "kmap").empty()
457 || kmap.empty()) {
458 primary_kbmap = kmap;
459 } else {
460 lexrc.printError("LyX: Keymap `$$Token' not found");
463 break;
465 case RC_KBMAP_SECONDARY:
466 if (lexrc.next()) {
467 string const kmap(os::internal_path(lexrc.getString()));
468 if (!libFileSearch("kbd", kmap, "kmap").empty()
469 || kmap.empty()) {
470 secondary_kbmap = kmap;
471 } else {
472 lexrc.printError("LyX: Keymap `$$Token' not found");
475 break;
477 case RC_FONT_ENCODING:
478 lexrc >> fontenc;
479 break;
481 case RC_PRINTER:
482 lexrc >> printer;
483 break;
485 case RC_PRINT_COMMAND:
486 if (lexrc.next(true)) {
487 print_command = lexrc.getString();
489 break;
491 case RC_PRINTEVENPAGEFLAG:
492 lexrc >> print_evenpage_flag;
493 break;
495 case RC_PRINTODDPAGEFLAG:
496 lexrc >> print_oddpage_flag;
497 break;
499 case RC_PRINTPAGERANGEFLAG:
500 lexrc >> print_pagerange_flag;
501 break;
503 case RC_PRINTCOPIESFLAG:
504 lexrc >> print_copies_flag;
505 break;
507 case RC_PRINTCOLLCOPIESFLAG:
508 lexrc >> print_collcopies_flag;
509 break;
511 case RC_PRINTREVERSEFLAG:
512 lexrc >> print_reverse_flag;
513 break;
515 case RC_PRINTLANDSCAPEFLAG:
516 lexrc >> print_landscape_flag;
517 break;
519 case RC_PRINTTOPRINTER:
520 lexrc >> print_to_printer;
521 break;
523 case RC_PRINT_ADAPTOUTPUT:
524 lexrc >> print_adapt_output;
525 break;
527 case RC_PRINTTOFILE:
528 if (lexrc.next()) {
529 print_to_file = os::internal_path(lexrc.getString());
531 break;
533 case RC_PRINTFILEEXTENSION:
534 lexrc >> print_file_extension;
535 break;
537 case RC_PRINTEXSTRAOPTIONS:
538 lexrc >> print_extra_options;
539 break;
541 case RC_PRINTSPOOL_COMMAND:
542 if (lexrc.next(true)) {
543 print_spool_command = lexrc.getString();
545 break;
547 case RC_PRINTSPOOL_PRINTERPREFIX:
548 lexrc >> print_spool_printerprefix;
549 break;
551 case RC_PRINTPAPERDIMENSIONFLAG:
552 lexrc >> print_paper_dimension_flag;
553 break;
555 case RC_PRINTPAPERFLAG:
556 lexrc >> print_paper_flag;
557 break;
559 case RC_DEFAULT_PAPERSIZE:
560 if (lexrc.next()) {
561 string const size = ascii_lowercase(lexrc.getString());
562 if (size == "usletter")
563 default_papersize = PAPER_USLETTER;
564 else if (size == "legal")
565 default_papersize = PAPER_USLEGAL;
566 else if (size == "executive")
567 default_papersize = PAPER_USEXECUTIVE;
568 else if (size == "a3")
569 default_papersize = PAPER_A3;
570 else if (size == "a4")
571 default_papersize = PAPER_A4;
572 else if (size == "a5")
573 default_papersize = PAPER_A5;
574 else if (size == "b5")
575 default_papersize = PAPER_B5;
576 else if (size == "default")
577 default_papersize = PAPER_DEFAULT;
579 break;
581 case RC_VIEWDVI_PAPEROPTION:
582 if (lexrc.next())
583 view_dvi_paper_option = lexrc.getString();
584 else
585 view_dvi_paper_option.erase();
586 break;
588 case RC_CHKTEX_COMMAND:
589 if (lexrc.next(true)) {
590 chktex_command = lexrc.getString();
592 break;
594 case RC_BIBTEX_ALTERNATIVES:
595 if (lexrc.next(true)) {
596 bibtex_alternatives.insert(lexrc.getString());
598 break;
600 case RC_BIBTEX_COMMAND:
601 if (lexrc.next(true)) {
602 bibtex_command = lexrc.getString();
604 break;
606 case RC_JBIBTEX_COMMAND:
607 if (lexrc.next(true)) {
608 jbibtex_command = lexrc.getString();
610 break;
612 case RC_INDEX_ALTERNATIVES:
613 if (lexrc.next(true)) {
614 index_alternatives.insert(lexrc.getString());
616 break;
618 case RC_INDEX_COMMAND:
619 if (lexrc.next(true)) {
620 index_command = lexrc.getString();
622 break;
624 case RC_JINDEX_COMMAND:
625 if (lexrc.next(true)) {
626 jindex_command = lexrc.getString();
628 break;
630 case RC_SPLITINDEX_COMMAND:
631 if (lexrc.next(true)) {
632 splitindex_command = lexrc.getString();
634 break;
636 case RC_NOMENCL_COMMAND:
637 if (lexrc.next(true)) {
638 nomencl_command = lexrc.getString();
640 break;
642 case RC_SCREEN_DPI:
643 lexrc >> dpi;
644 break;
646 case RC_SCREEN_ZOOM:
647 lexrc >> zoom;
648 break;
650 case RC_GEOMETRY_SESSION:
651 lexrc >> allow_geometry_session;
652 break;
654 case RC_SCREEN_FONT_SIZES:
655 lexrc >> font_sizes[FONT_SIZE_TINY];
656 lexrc >> font_sizes[FONT_SIZE_SCRIPT];
657 lexrc >> font_sizes[FONT_SIZE_FOOTNOTE];
658 lexrc >> font_sizes[FONT_SIZE_SMALL];
659 lexrc >> font_sizes[FONT_SIZE_NORMAL];
660 lexrc >> font_sizes[FONT_SIZE_LARGE];
661 lexrc >> font_sizes[FONT_SIZE_LARGER];
662 lexrc >> font_sizes[FONT_SIZE_LARGEST];
663 lexrc >> font_sizes[FONT_SIZE_HUGE];
664 lexrc >> font_sizes[FONT_SIZE_HUGER];
665 break;
667 case RC_SCREEN_FONT_SCALABLE:
668 lexrc >> use_scalable_fonts;
669 break;
671 case RC_AUTOSAVE:
672 lexrc >> autosave;
673 break;
675 case RC_DOCUMENTPATH:
676 if (lexrc.next()) {
677 document_path = os::internal_path(lexrc.getString());
678 document_path = expandPath(document_path);
680 break;
682 case RC_EXAMPLEPATH:
683 if (lexrc.next()) {
684 example_path = os::internal_path(lexrc.getString());
685 example_path = expandPath(example_path);
687 break;
689 case RC_TEMPLATEPATH:
690 if (lexrc.next()) {
691 template_path = os::internal_path(lexrc.getString());
692 template_path = expandPath(template_path);
694 break;
696 case RC_TEMPDIRPATH:
697 if (lexrc.next()) {
698 tempdir_path = os::internal_path(lexrc.getString());
699 tempdir_path = expandPath(tempdir_path);
701 break;
703 case RC_THESAURUSDIRPATH:
704 if (lexrc.next()) {
705 thesaurusdir_path = os::internal_path(lexrc.getString());
706 thesaurusdir_path = expandPath(thesaurusdir_path);
708 break;
710 case RC_HUNSPELLDIR_PATH:
711 if (lexrc.next()) {
712 hunspelldir_path = os::internal_path(lexrc.getString());
713 hunspelldir_path = expandPath(hunspelldir_path);
715 break;
717 case RC_USELASTFILEPOS:
718 lexrc >> use_lastfilepos;
719 break;
721 case RC_LOADSESSION:
722 lexrc >> load_session;
723 break;
725 case RC_MOUSE_WHEEL_SPEED:
726 lexrc >> mouse_wheel_speed;
727 break;
729 case RC_COMPLETION_INLINE_DELAY:
730 lexrc >> completion_inline_delay;
731 break;
733 case RC_COMPLETION_INLINE_MATH:
734 lexrc >> completion_inline_math;
735 break;
737 case RC_COMPLETION_INLINE_TEXT:
738 lexrc >> completion_inline_text;
739 break;
741 case RC_COMPLETION_INLINE_DOTS:
742 lexrc >> completion_inline_dots;
743 break;
745 case RC_AUTOCORRECTION_MATH:
746 lexrc >> autocorrection_math;
747 break;
749 case RC_COMPLETION_POPUP_DELAY:
750 lexrc >> completion_popup_delay;
751 break;
753 case RC_COMPLETION_POPUP_MATH:
754 lexrc >> completion_popup_math;
755 break;
757 case RC_COMPLETION_POPUP_TEXT:
758 lexrc >> completion_popup_text;
759 break;
761 case RC_COMPLETION_CURSOR_TEXT:
762 lexrc >> completion_cursor_text;
763 break;
765 case RC_COMPLETION_POPUP_AFTER_COMPLETE:
766 lexrc >> completion_popup_after_complete;
767 break;
769 case RC_NUMLASTFILES:
770 lexrc >> num_lastfiles;
771 break;
773 case RC_CHECKLASTFILES:
774 lexrc >> check_lastfiles;
775 break;
777 case RC_SCREEN_FONT_ROMAN:
778 if (lexrc.next()) {
779 roman_font_name = lexrc.getString();
780 oldFontFormat(roman_font_name,
781 roman_font_foundry);
783 break;
785 case RC_SCREEN_FONT_SANS:
786 if (lexrc.next()) {
787 sans_font_name = lexrc.getString();
788 oldFontFormat(sans_font_name, sans_font_foundry);
790 break;
792 case RC_SCREEN_FONT_TYPEWRITER:
793 if (lexrc.next()) {
794 typewriter_font_name = lexrc.getString();
795 oldFontFormat(typewriter_font_name,
796 typewriter_font_foundry);
798 break;
800 case RC_SCREEN_FONT_ROMAN_FOUNDRY:
801 lexrc >> roman_font_foundry;
802 break;
804 case RC_SCREEN_FONT_SANS_FOUNDRY:
805 lexrc >> sans_font_foundry;
806 break;
808 case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
809 lexrc >> typewriter_font_foundry;
810 break;
812 case RC_SET_COLOR: {
813 if (!lexrc.next()) {
814 lexrc.printError("Missing color tag.");
815 break;
817 string lyx_name = lexrc.getString();
819 if (!lexrc.next()) {
820 lexrc.printError("Missing color name for color: `$$Token'");
821 break;
823 string x11_name = lexrc.getString();
825 ColorCode const col =
826 lcolor.getFromLyXName(lyx_name);
827 if (col == Color_none ||
828 col == Color_inherit ||
829 col == Color_ignore)
830 break;
832 if (!lcolor.setColor(col, x11_name))
833 LYXERR0("Bad lyxrc set_color for " << lyx_name);
834 break;
837 case RC_AUTOREGIONDELETE:
838 // Auto region delete defaults to true
839 lexrc >> auto_region_delete;
840 break;
842 case RC_SERVERPIPE:
843 if (lexrc.next()) {
844 lyxpipes = os::internal_path(lexrc.getString());
845 lyxpipes = expandPath(lyxpipes);
847 break;
849 case RC_CURSOR_FOLLOWS_SCROLLBAR:
850 lexrc >> cursor_follows_scrollbar;
851 break;
853 case RC_SCROLL_BELOW_DOCUMENT:
854 lexrc >> scroll_below_document;
855 break;
857 case RC_MAC_LIKE_WORD_MOVEMENT:
858 lexrc >> mac_like_word_movement;
859 break;
861 case RC_MACRO_EDIT_STYLE:
862 if (lexrc.next()) {
863 switch (lexrc.getInteger()) {
864 case 0: macro_edit_style = MACRO_EDIT_INLINE_BOX; break;
865 case 1: macro_edit_style = MACRO_EDIT_INLINE; break;
866 case 2: macro_edit_style = MACRO_EDIT_LIST; break;
869 break;
871 case RC_DIALOGS_ICONIFY_WITH_MAIN:
872 lexrc >> dialogs_iconify_with_main;
873 break;
875 case RC_PLAINTEXT_LINELEN:
876 lexrc >> plaintext_linelen;
877 break;
878 // Spellchecker settings:
879 case RC_ACCEPT_COMPOUND:
880 lexrc >> spellchecker_accept_compound;
881 break;
882 case RC_USE_TOOLTIP:
883 lexrc >> use_tooltip;
884 break;
885 case RC_USE_PIXMAP_CACHE:
886 lexrc >> use_pixmap_cache;
887 break;
888 case RC_SPELLCHECKER:
889 lexrc >> spellchecker;
890 break;
891 case RC_ALT_LANG:
892 lexrc >> spellchecker_alt_lang;
893 break;
894 case RC_ESC_CHARS:
895 lexrc >> spellchecker_esc_chars;
896 break;
897 case RC_SPELLCHECK_CONTINUOUSLY:
898 lexrc >> spellcheck_continuously;
899 break;
900 case RC_MAKE_BACKUP:
901 lexrc >> make_backup;
902 break;
903 case RC_BACKUPDIR_PATH:
904 if (lexrc.next()) {
905 backupdir_path = os::internal_path(lexrc.getString());
906 backupdir_path = expandPath(backupdir_path);
908 break;
909 case RC_DATE_INSERT_FORMAT:
910 lexrc >> date_insert_format;
911 break;
912 case RC_LANGUAGE_PACKAGE:
913 lexrc >> language_package;
914 break;
915 case RC_LANGUAGE_AUTO_BEGIN:
916 lexrc >> language_auto_begin;
917 break;
918 case RC_LANGUAGE_AUTO_END:
919 lexrc >> language_auto_end;
920 break;
921 case RC_LANGUAGE_GLOBAL_OPTIONS:
922 lexrc >> language_global_options;
923 break;
924 case RC_LANGUAGE_USE_BABEL:
925 lexrc >> language_use_babel;
926 break;
927 case RC_LANGUAGE_COMMAND_BEGIN:
928 lexrc >> language_command_begin;
929 break;
930 case RC_LANGUAGE_COMMAND_END:
931 lexrc >> language_command_end;
932 break;
933 case RC_LANGUAGE_COMMAND_LOCAL:
934 lexrc >> language_command_local;
935 break;
936 case RC_RTL_SUPPORT:
937 lexrc >> rtl_support;
938 break;
939 case RC_VISUAL_CURSOR:
940 lexrc >> visual_cursor;
941 break;
942 case RC_AUTO_NUMBER:
943 lexrc >> auto_number;
944 break;
945 case RC_MARK_FOREIGN_LANGUAGE:
946 lexrc >> mark_foreign_language;
947 break;
949 case RC_COPIER: {
950 string fmt, command;
951 if (lexrc.next())
952 fmt = lexrc.getString();
953 if (lexrc.next(true))
954 command = lexrc.getString();
955 setMover(fmt, command);
956 break;
959 case RC_CONVERTER: {
960 string from, to, command, flags;
961 if (lexrc.next())
962 from = lexrc.getString();
963 if (lexrc.next())
964 to = lexrc.getString();
965 if (lexrc.next(true))
966 command = lexrc.getString();
967 if (lexrc.next())
968 flags = lexrc.getString();
969 if (command.empty())
970 theConverters().erase(from, to);
971 else
972 theConverters().add(from, to, command, flags);
973 break;
975 // compatibility with versions older than 1.4.0 only
976 case RC_VIEWER: {
977 string format, command;
978 lexrc >> format >> command;
979 formats.setViewer(format, command);
980 break;
982 case RC_FORMAT: {
983 string format, extension, prettyname, shortcut;
984 lexrc >> format >> extension >> prettyname >> shortcut;
985 string viewer, editor;
986 if (lexrc.next(true))
987 viewer = lexrc.getString();
988 if (lexrc.next(true))
989 editor = lexrc.getString();
990 string flags;
991 // Hack to ensure compatibility with versions older
992 // than 1.5.0
993 int le = lexrc.lex();
994 if (le != Lexer::LEX_FEOF && le != Lexer::LEX_UNDEF) {
995 flags = lexrc.getString();
996 if (le != Lexer::LEX_DATA) {
997 // We have got a known token.
998 // Therefore this is an old style
999 // format definition without
1000 // flags.
1001 lexrc.pushToken(flags);
1002 flags.erase();
1005 int flgs = Format::none;
1006 while (!flags.empty()) {
1007 string flag;
1008 flags = split(flags, flag, ',');
1009 if (flag == "document")
1010 flgs |= Format::document;
1011 else if (flag == "vector")
1012 flgs |= Format::vector;
1013 else
1014 LYXERR0("Ignoring unknown flag `"
1015 << flag << "' for format `"
1016 << format << "'.");
1018 if (prettyname.empty()) {
1019 if (theConverters().formatIsUsed(format))
1020 LYXERR0("Can't delete format " << format);
1021 else
1022 formats.erase(format);
1023 } else {
1024 formats.add(format, extension, prettyname,
1025 shortcut, viewer, editor, flgs);
1027 break;
1029 case RC_DEFAULT_VIEW_FORMAT:
1030 lexrc >> default_view_format;
1031 break;
1033 case RC_DEFAULT_LANGUAGE:
1034 lexrc >> default_language;
1035 break;
1037 case RC_GUI_LANGUAGE:
1038 lexrc >> gui_language;
1039 break;
1041 case RC_LABEL_INIT_LENGTH:
1042 lexrc >> label_init_length;
1043 break;
1045 case RC_SHOW_BANNER:
1046 lexrc >> show_banner;
1047 break;
1049 case RC_PREVIEW:
1050 if (lexrc.next()) {
1051 string const tmp = lexrc.getString();
1052 if (tmp == "true" || tmp == "on")
1053 preview = PREVIEW_ON;
1054 else if (tmp == "no_math")
1055 preview = PREVIEW_NO_MATH;
1056 else {
1057 preview = PREVIEW_OFF;
1058 if (tmp != "false" && tmp != "off")
1059 LYXERR0("Unrecognized preview status \""
1060 << tmp << '\n');
1063 break;
1065 case RC_PREVIEW_HASHED_LABELS:
1066 lexrc >> preview_hashed_labels;
1067 break;
1069 case RC_PREVIEW_SCALE_FACTOR:
1070 lexrc >> preview_scale_factor;
1071 break;
1073 case RC_USER_NAME:
1074 lexrc >> user_name;
1075 break;
1076 case RC_USER_EMAIL:
1077 lexrc >> user_email;
1078 break;
1080 case RC_PATH_PREFIX:
1081 lexrc >> path_prefix;
1082 break;
1084 case RC_USE_CONVERTER_CACHE:
1085 lexrc >> use_converter_cache;
1086 break;
1087 case RC_CONVERTER_CACHE_MAXAGE:
1088 lexrc >> converter_cache_maxage;
1089 break;
1091 case RC_SORT_LAYOUTS:
1092 lexrc >> sort_layouts;
1093 break;
1094 case RC_GROUP_LAYOUTS:
1095 lexrc >> group_layouts;
1096 break;
1097 case RC_FULL_SCREEN_LIMIT:
1098 lexrc >> full_screen_limit;
1099 break;
1100 case RC_FULL_SCREEN_TOOLBARS:
1101 lexrc >> full_screen_toolbars;
1102 break;
1103 case RC_FULL_SCREEN_SCROLLBAR:
1104 lexrc >> full_screen_scrollbar;
1105 break;
1106 case RC_FULL_SCREEN_TABBAR:
1107 lexrc >> full_screen_tabbar;
1108 break;
1109 case RC_FULL_SCREEN_MENUBAR:
1110 lexrc >> full_screen_menubar;
1111 break;
1112 case RC_FULL_SCREEN_WIDTH:
1113 lexrc >> full_screen_width;
1114 break;
1115 case RC_OPEN_BUFFERS_IN_TABS:
1116 lexrc >> open_buffers_in_tabs;
1117 break;
1119 // Obsoteted in 1.4.0
1120 case RC_USETEMPDIR:
1121 // Obsoleted in 2.0
1122 case RC_SPELL_COMMAND:
1123 case RC_PERS_DICT:
1124 case RC_PLAINTEXT_ROFF_COMMAND:
1125 case RC_USE_ALT_LANG:
1126 case RC_USE_ESC_CHARS:
1127 case RC_USE_INP_ENC:
1128 case RC_USE_PERS_DICT:
1129 case RC_USE_SPELL_LIB:
1130 LYXERR(Debug::LYXRC, "Skipping obsolete tag `"
1131 << lexrc.getString() << "'.");
1132 lexrc.next(true);
1133 break;
1135 case RC_LAST:
1136 break; // this is just a dummy
1140 /// Update converters data-structures
1141 theConverters().update(formats);
1142 theConverters().buildGraph();
1144 return 0;
1148 void LyXRC::write(FileName const & filename, bool ignore_system_lyxrc) const
1150 ofstream ofs(filename.toFilesystemEncoding().c_str());
1151 if (ofs)
1152 write(ofs, ignore_system_lyxrc);
1156 void LyXRC::print() const
1158 if (lyxerr.debugging())
1159 write(lyxerr, false);
1160 else
1161 write(cout, false);
1165 class SameMover {
1166 public:
1167 typedef pair<string, SpecialisedMover> Data;
1169 SameMover(Data const & comparison)
1170 : comparison_(comparison) {}
1172 bool operator()(Data const & data) const
1174 return data.first == comparison_.first &&
1175 data.second.command() == comparison_.second.command();
1178 private:
1179 Data comparison_;
1183 namespace {
1185 // Escape \ and " so that LyXLex can read the string later
1186 string escapeCommand(string const & str) {
1187 return subst(subst(str , "\\", "\\\\"),
1188 "\"", "\\\"");
1194 void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) const
1196 LyXRCTags tag = RC_LAST;
1198 if (!name.empty()) {
1199 for (int i = 0; i != lyxrcCount; ++i)
1200 if ("\\" + name == lyxrcTags[i].tag)
1201 tag = static_cast<LyXRCTags>(lyxrcTags[i].code);
1204 if (tag == RC_LAST)
1205 os << "# LyX " << lyx_version
1206 << " generated this file. If you want to make your own\n"
1207 << "# modifications you should do them from inside LyX and save.\n"
1208 << "\n";
1210 // Why the switch you might ask. It is a trick to ensure that all
1211 // the elements in the LyXRCTags enum are handled. As you can see
1212 // there are no breaks at all. So it is just a huge fall-through.
1213 // The nice thing is that we will get a warning from the compiler
1214 // if we forget an element.
1215 switch (tag) {
1216 case RC_LAST:
1217 case RC_INPUT:
1218 // input/include files are not done here
1219 case RC_BINDFILE:
1220 if (ignore_system_lyxrc ||
1221 bind_file != system_lyxrc.bind_file) {
1222 string const path = os::external_path(bind_file);
1223 os << "\\bind_file \"" << path << "\"\n";
1225 if (tag != RC_LAST)
1226 break;
1228 case RC_DEFFILE:
1229 if (ignore_system_lyxrc ||
1230 def_file != system_lyxrc.def_file) {
1231 string const path = os::external_path(def_file);
1232 os << "\\def_file \"" << path << "\"\n";
1234 if (tag != RC_LAST)
1235 break;
1238 // Misc Section
1240 os << "\n#\n"
1241 << "# MISC SECTION ######################################\n"
1242 << "#\n\n";
1243 // bind files are not done here.
1245 case RC_PATH_PREFIX:
1246 if (ignore_system_lyxrc ||
1247 path_prefix != system_lyxrc.path_prefix) {
1248 os << "\\path_prefix \"" << path_prefix << "\"\n";
1250 if (tag != RC_LAST)
1251 break;
1252 case RC_UIFILE:
1253 if (ignore_system_lyxrc ||
1254 ui_file != system_lyxrc.ui_file) {
1255 string const path = os::external_path(ui_file);
1256 os << "\\ui_file \"" << path << "\"\n";
1258 if (tag != RC_LAST)
1259 break;
1260 case RC_AUTOREGIONDELETE:
1261 if (ignore_system_lyxrc ||
1262 auto_region_delete != system_lyxrc.auto_region_delete) {
1263 os << "# Set to false to inhibit automatic replacement of\n"
1264 << "# the current selection.\n"
1265 << "\\auto_region_delete " << convert<string>(auto_region_delete)
1266 << '\n';
1268 if (tag != RC_LAST)
1269 break;
1270 case RC_AUTORESET_OPTIONS:
1271 if (ignore_system_lyxrc ||
1272 auto_reset_options != system_lyxrc.auto_reset_options) {
1273 os << "# Set to false to inhibit automatic reset of\n"
1274 << "# the class options to defaults on class change.\n"
1275 << "\\auto_reset_options "
1276 << convert<string>(auto_reset_options)
1277 << '\n';
1279 if (tag != RC_LAST)
1280 break;
1281 case RC_AUTOSAVE:
1282 if (ignore_system_lyxrc ||
1283 autosave != system_lyxrc.autosave) {
1284 os << "# The time interval between auto-saves in seconds.\n"
1285 << "\\autosave " << autosave << '\n';
1287 if (tag != RC_LAST)
1288 break;
1289 case RC_DISPLAY_GRAPHICS:
1290 if (ignore_system_lyxrc ||
1291 display_graphics != system_lyxrc.display_graphics) {
1292 os << "# Display graphics within LyX\n"
1293 << "# true|false\n"
1294 << "\\display_graphics "
1295 << (display_graphics ? "true" : "false")
1296 << '\n';
1298 if (tag != RC_LAST)
1299 break;
1300 case RC_SORT_LAYOUTS:
1301 if (ignore_system_lyxrc ||
1302 sort_layouts != system_lyxrc.sort_layouts) {
1303 os << "# Sort layouts alphabetically.\n"
1304 << "\\sort_layouts " << convert<string>(sort_layouts) << '\n';
1306 if (tag != RC_LAST)
1307 break;
1308 case RC_GROUP_LAYOUTS:
1309 if (ignore_system_lyxrc ||
1310 group_layouts != system_lyxrc.group_layouts) {
1311 os << "# Group layouts by their category.\n"
1312 << "\\group_layouts " << convert<string>(group_layouts) << '\n';
1314 if (tag != RC_LAST)
1315 break;
1316 case RC_VIEWDVI_PAPEROPTION:
1317 if (ignore_system_lyxrc ||
1318 view_dvi_paper_option
1319 != system_lyxrc.view_dvi_paper_option) {
1320 os << "# Options used to specify paper size to the\n"
1321 << "# view_dvi_command (e.g. -paper)\n"
1322 << "\\view_dvi_paper_option \""
1323 << view_dvi_paper_option << "\"\n";
1325 if (tag != RC_LAST)
1326 break;
1327 case RC_DEFAULT_PAPERSIZE:
1328 if (ignore_system_lyxrc ||
1329 default_papersize != system_lyxrc.default_papersize) {
1330 os << "# The default papersize to use.\n"
1331 << "\\default_papersize \"";
1332 switch (default_papersize) {
1333 case PAPER_DEFAULT:
1334 os << "default"; break;
1335 case PAPER_USLETTER:
1336 os << "usletter"; break;
1337 case PAPER_USLEGAL:
1338 os << "legal"; break;
1339 case PAPER_USEXECUTIVE:
1340 os << "executive"; break;
1341 case PAPER_A3:
1342 os << "a3"; break;
1343 case PAPER_A4:
1344 os << "a4"; break;
1345 case PAPER_A5:
1346 os << "a5"; break;
1347 case PAPER_B5:
1348 os << "b5"; break;
1349 case PAPER_CUSTOM:
1350 case PAPER_B3:
1351 case PAPER_B4: break;
1353 os << "\"\n";
1355 if (tag != RC_LAST)
1356 break;
1357 case RC_CHKTEX_COMMAND:
1358 if (ignore_system_lyxrc ||
1359 chktex_command != system_lyxrc.chktex_command) {
1360 os << "\\chktex_command \"" << escapeCommand(chktex_command) << "\"\n";
1362 if (tag != RC_LAST)
1363 break;
1364 case RC_BIBTEX_ALTERNATIVES: {
1365 set<string>::const_iterator it = bibtex_alternatives.begin();
1366 set<string>::const_iterator end = bibtex_alternatives.end();
1367 for ( ; it != end; ++it) {
1368 if (ignore_system_lyxrc
1369 || !system_lyxrc.bibtex_alternatives.count(*it))
1370 os << "\\bibtex_alternatives \""
1371 << *it << "\"\n";
1373 if (tag != RC_LAST)
1374 break;
1376 case RC_BIBTEX_COMMAND:
1377 if (ignore_system_lyxrc ||
1378 bibtex_command != system_lyxrc.bibtex_command) {
1379 os << "\\bibtex_command \"" << escapeCommand(bibtex_command) << "\"\n";
1381 if (tag != RC_LAST)
1382 break;
1383 case RC_JBIBTEX_COMMAND:
1384 if (ignore_system_lyxrc ||
1385 jbibtex_command != system_lyxrc.jbibtex_command) {
1386 os << "\\jbibtex_command \"" << escapeCommand(jbibtex_command) << "\"\n";
1388 if (tag != RC_LAST)
1389 break;
1390 case RC_INDEX_ALTERNATIVES: {
1391 set<string>::const_iterator it = index_alternatives.begin();
1392 set<string>::const_iterator end = index_alternatives.end();
1393 for ( ; it != end; ++it) {
1394 if (ignore_system_lyxrc
1395 || !system_lyxrc.index_alternatives.count(*it))
1396 os << "\\index_alternatives \""
1397 << *it << "\"\n";
1399 if (tag != RC_LAST)
1400 break;
1402 case RC_INDEX_COMMAND:
1403 if (ignore_system_lyxrc ||
1404 index_command != system_lyxrc.index_command) {
1405 os << "\\index_command \"" << escapeCommand(index_command) << "\"\n";
1407 if (tag != RC_LAST)
1408 break;
1409 case RC_JINDEX_COMMAND:
1410 if (ignore_system_lyxrc ||
1411 jindex_command != system_lyxrc.jindex_command) {
1412 os << "\\jindex_command \"" << escapeCommand(jindex_command) << "\"\n";
1414 if (tag != RC_LAST)
1415 break;
1416 case RC_SPLITINDEX_COMMAND:
1417 if (ignore_system_lyxrc ||
1418 splitindex_command != system_lyxrc.splitindex_command) {
1419 os << "\\splitindex_command \"" << escapeCommand(splitindex_command) << "\"\n";
1421 if (tag != RC_LAST)
1422 break;
1423 case RC_NOMENCL_COMMAND:
1424 if (ignore_system_lyxrc ||
1425 nomencl_command != system_lyxrc.nomencl_command) {
1426 os << "\\nomencl_command \"" << escapeCommand(nomencl_command) << "\"\n";
1428 if (tag != RC_LAST)
1429 break;
1430 case RC_TEX_EXPECTS_WINDOWS_PATHS:
1431 if (ignore_system_lyxrc ||
1432 windows_style_tex_paths != system_lyxrc.windows_style_tex_paths) {
1433 os << "\\tex_expects_windows_paths "
1434 << convert<string>(windows_style_tex_paths) << '\n';
1436 if (tag != RC_LAST)
1437 break;
1438 case RC_TEX_ALLOWS_SPACES:
1439 if (tex_allows_spaces != system_lyxrc.tex_allows_spaces) {
1440 os << "\\tex_allows_spaces "
1441 << convert<string>(tex_allows_spaces) << '\n';
1443 if (tag != RC_LAST)
1444 break;
1445 case RC_KBMAP:
1446 if (ignore_system_lyxrc ||
1447 use_kbmap != system_lyxrc.use_kbmap) {
1448 os << "\\kbmap " << convert<string>(use_kbmap) << '\n';
1450 if (tag != RC_LAST)
1451 break;
1452 case RC_KBMAP_PRIMARY:
1453 if (ignore_system_lyxrc ||
1454 primary_kbmap != system_lyxrc.primary_kbmap) {
1455 string const path = os::external_path(primary_kbmap);
1456 os << "\\kbmap_primary \"" << path << "\"\n";
1458 if (tag != RC_LAST)
1459 break;
1460 case RC_KBMAP_SECONDARY:
1461 if (ignore_system_lyxrc ||
1462 secondary_kbmap != system_lyxrc.secondary_kbmap) {
1463 string const path = os::external_path(secondary_kbmap);
1464 os << "\\kbmap_secondary \"" << path << "\"\n";
1466 if (tag != RC_LAST)
1467 break;
1468 case RC_SERVERPIPE:
1469 if (ignore_system_lyxrc ||
1470 lyxpipes != system_lyxrc.lyxpipes) {
1471 string const path = os::external_path(lyxpipes);
1472 os << "\\serverpipe \"" << path << "\"\n";
1474 if (tag != RC_LAST)
1475 break;
1476 case RC_DATE_INSERT_FORMAT:
1477 if (ignore_system_lyxrc ||
1478 date_insert_format != system_lyxrc.date_insert_format) {
1479 os << "\\date_insert_format \"" << date_insert_format
1480 << "\"\n";
1482 if (tag != RC_LAST)
1483 break;
1484 case RC_LABEL_INIT_LENGTH:
1485 if (ignore_system_lyxrc ||
1486 label_init_length != system_lyxrc.label_init_length) {
1487 os << "\\label_init_length " << label_init_length
1488 << '\n';
1490 if (tag != RC_LAST)
1491 break;
1493 case RC_USER_NAME:
1494 os << "\\user_name \"" << user_name << "\"\n";
1495 if (tag != RC_LAST)
1496 break;
1498 case RC_USER_EMAIL:
1499 os << "\\user_email \"" << user_email << "\"\n";
1500 if (tag != RC_LAST)
1501 break;
1503 case RC_SHOW_BANNER:
1504 if (ignore_system_lyxrc ||
1505 show_banner != system_lyxrc.show_banner) {
1506 os << "\\show_banner " << convert<string>(show_banner) << '\n';
1508 if (tag != RC_LAST)
1509 break;
1511 case RC_PREVIEW:
1512 if (ignore_system_lyxrc ||
1513 preview != system_lyxrc.preview) {
1514 string status;
1515 switch (preview) {
1516 case PREVIEW_ON:
1517 status = "on";
1518 break;
1519 case PREVIEW_NO_MATH:
1520 status = "no_math";
1521 break;
1522 case PREVIEW_OFF:
1523 status = "off";
1524 break;
1526 os << "\\preview " << status << '\n';
1528 if (tag != RC_LAST)
1529 break;
1531 case RC_PREVIEW_HASHED_LABELS:
1532 if (ignore_system_lyxrc ||
1533 preview_hashed_labels !=
1534 system_lyxrc.preview_hashed_labels) {
1535 os << "\\preview_hashed_labels "
1536 << convert<string>(preview_hashed_labels) << '\n';
1538 if (tag != RC_LAST)
1539 break;
1541 case RC_PREVIEW_SCALE_FACTOR:
1542 if (ignore_system_lyxrc ||
1543 preview_scale_factor != system_lyxrc.preview_scale_factor) {
1544 os << "\\preview_scale_factor "
1545 << preview_scale_factor << '\n';
1547 if (tag != RC_LAST)
1548 break;
1550 case RC_USE_CONVERTER_CACHE:
1551 if (ignore_system_lyxrc ||
1552 use_converter_cache != system_lyxrc.use_converter_cache) {
1553 os << "\\use_converter_cache "
1554 << convert<string>(use_converter_cache) << '\n';
1556 if (tag != RC_LAST)
1557 break;
1559 case RC_CONVERTER_CACHE_MAXAGE:
1560 if (ignore_system_lyxrc ||
1561 converter_cache_maxage != system_lyxrc.converter_cache_maxage) {
1562 os << "\\converter_cache_maxage "
1563 << converter_cache_maxage << '\n';
1565 if (tag != RC_LAST)
1566 break;
1568 os << "\n#\n"
1569 << "# SCREEN & FONTS SECTION ############################\n"
1570 << "#\n\n";
1572 case RC_SCREEN_DPI:
1573 if (ignore_system_lyxrc ||
1574 dpi != system_lyxrc.dpi) {
1575 os << "\\screen_dpi " << dpi << '\n';
1577 if (tag != RC_LAST)
1578 break;
1579 case RC_SCREEN_ZOOM:
1580 if (ignore_system_lyxrc ||
1581 zoom != system_lyxrc.zoom) {
1582 os << "\\screen_zoom " << zoom << '\n';
1584 if (tag != RC_LAST)
1585 break;
1586 case RC_GEOMETRY_SESSION:
1587 if (ignore_system_lyxrc ||
1588 allow_geometry_session != system_lyxrc.allow_geometry_session) {
1589 os << "\\allow_geometry_session " << convert<string>(allow_geometry_session)
1590 << '\n';
1592 if (tag != RC_LAST)
1593 break;
1594 case RC_CURSOR_FOLLOWS_SCROLLBAR:
1595 if (ignore_system_lyxrc ||
1596 cursor_follows_scrollbar
1597 != system_lyxrc.cursor_follows_scrollbar) {
1598 os << "\\cursor_follows_scrollbar "
1599 << convert<string>(cursor_follows_scrollbar) << '\n';
1601 if (tag != RC_LAST)
1602 break;
1603 case RC_SCROLL_BELOW_DOCUMENT:
1604 if (ignore_system_lyxrc ||
1605 scroll_below_document
1606 != system_lyxrc.scroll_below_document) {
1607 os << "\\scroll_below_document "
1608 << convert<string>(scroll_below_document) << '\n';
1610 if (tag != RC_LAST)
1611 break;
1612 case RC_MAC_LIKE_WORD_MOVEMENT:
1613 if (ignore_system_lyxrc ||
1614 mac_like_word_movement
1615 != system_lyxrc.mac_like_word_movement) {
1616 os << "\\mac_like_word_movement "
1617 << convert<string>(mac_like_word_movement) << '\n';
1619 if (tag != RC_LAST)
1620 break;
1621 case RC_MACRO_EDIT_STYLE:
1622 if (ignore_system_lyxrc ||
1623 macro_edit_style
1624 != system_lyxrc.macro_edit_style) {
1625 os << "\\macro_edit_style ";
1626 switch (macro_edit_style) {
1627 case MACRO_EDIT_INLINE_BOX: os << "0\n"; break;
1628 case MACRO_EDIT_INLINE: os << "1\n"; break;
1629 case MACRO_EDIT_LIST: os << "2\n"; break;
1632 if (tag != RC_LAST)
1633 break;
1634 case RC_DIALOGS_ICONIFY_WITH_MAIN:
1635 if (ignore_system_lyxrc ||
1636 dialogs_iconify_with_main
1637 != system_lyxrc.dialogs_iconify_with_main) {
1638 os << "\\dialogs_iconify_with_main "
1639 << convert<string>(dialogs_iconify_with_main) << '\n';
1641 if (tag != RC_LAST)
1642 break;
1643 case RC_SCREEN_FONT_ROMAN:
1644 if (ignore_system_lyxrc ||
1645 roman_font_name != system_lyxrc.roman_font_name) {
1646 os << "\\screen_font_roman \"" << roman_font_name
1647 << "\"\n";
1649 if (tag != RC_LAST)
1650 break;
1651 case RC_SCREEN_FONT_ROMAN_FOUNDRY:
1652 if (ignore_system_lyxrc ||
1653 roman_font_foundry != system_lyxrc.roman_font_foundry) {
1654 os << "\\screen_font_roman_foundry \"" << roman_font_foundry
1655 << "\"\n";
1657 if (tag != RC_LAST)
1658 break;
1659 case RC_SCREEN_FONT_SANS:
1660 if (ignore_system_lyxrc ||
1661 sans_font_name != system_lyxrc.sans_font_name) {
1662 os << "\\screen_font_sans \"" << sans_font_name
1663 << "\"\n";
1665 if (tag != RC_LAST)
1666 break;
1667 case RC_SCREEN_FONT_SANS_FOUNDRY:
1668 if (ignore_system_lyxrc ||
1669 sans_font_foundry != system_lyxrc.sans_font_foundry) {
1670 os << "\\screen_font_sans_foundry \"" << sans_font_foundry
1671 << "\"\n";
1673 if (tag != RC_LAST)
1674 break;
1675 case RC_SCREEN_FONT_TYPEWRITER:
1676 if (ignore_system_lyxrc ||
1677 typewriter_font_name != system_lyxrc.typewriter_font_name) {
1678 os << "\\screen_font_typewriter \""
1679 << typewriter_font_name << "\"\n";
1681 if (tag != RC_LAST)
1682 break;
1683 case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
1684 if (ignore_system_lyxrc ||
1685 typewriter_font_foundry != system_lyxrc.typewriter_font_foundry) {
1686 os << "\\screen_font_typewriter_foundry \""
1687 << typewriter_font_foundry << "\"\n";
1689 if (tag != RC_LAST)
1690 break;
1692 case RC_SCREEN_FONT_SCALABLE:
1693 if (ignore_system_lyxrc ||
1694 use_scalable_fonts != system_lyxrc.use_scalable_fonts) {
1695 os << "\\screen_font_scalable "
1696 << convert<string>(use_scalable_fonts)
1697 << '\n';
1699 if (tag != RC_LAST)
1700 break;
1701 case RC_SCREEN_FONT_SIZES:
1702 if (ignore_system_lyxrc ||
1703 font_sizes[FONT_SIZE_TINY]
1704 != system_lyxrc.font_sizes[FONT_SIZE_TINY] ||
1705 font_sizes[FONT_SIZE_SCRIPT]
1706 != system_lyxrc.font_sizes[FONT_SIZE_SCRIPT] ||
1707 font_sizes[FONT_SIZE_FOOTNOTE]
1708 != system_lyxrc.font_sizes[FONT_SIZE_FOOTNOTE] ||
1709 font_sizes[FONT_SIZE_SMALL]
1710 != system_lyxrc.font_sizes[FONT_SIZE_SMALL] ||
1711 font_sizes[FONT_SIZE_NORMAL]
1712 != system_lyxrc.font_sizes[FONT_SIZE_NORMAL] ||
1713 font_sizes[FONT_SIZE_LARGE]
1714 != system_lyxrc.font_sizes[FONT_SIZE_LARGE] ||
1715 font_sizes[FONT_SIZE_LARGER]
1716 != system_lyxrc.font_sizes[FONT_SIZE_LARGER] ||
1717 font_sizes[FONT_SIZE_LARGEST]
1718 != system_lyxrc.font_sizes[FONT_SIZE_LARGEST] ||
1719 font_sizes[FONT_SIZE_HUGE]
1720 != system_lyxrc.font_sizes[FONT_SIZE_HUGE] ||
1721 font_sizes[FONT_SIZE_HUGER]
1722 != system_lyxrc.font_sizes[FONT_SIZE_HUGER]) {
1723 os.setf(ios::fixed);
1724 os.precision(2);
1725 os << "\\screen_font_sizes"
1726 << ' ' << font_sizes[FONT_SIZE_TINY]
1727 << ' ' << font_sizes[FONT_SIZE_SCRIPT]
1728 << ' ' << font_sizes[FONT_SIZE_FOOTNOTE]
1729 << ' ' << font_sizes[FONT_SIZE_SMALL]
1730 << ' ' << font_sizes[FONT_SIZE_NORMAL]
1731 << ' ' << font_sizes[FONT_SIZE_LARGE]
1732 << ' ' << font_sizes[FONT_SIZE_LARGER]
1733 << ' ' << font_sizes[FONT_SIZE_LARGEST]
1734 << ' ' << font_sizes[FONT_SIZE_HUGE]
1735 << ' ' << font_sizes[FONT_SIZE_HUGER]
1736 << '\n';
1738 if (tag != RC_LAST)
1739 break;
1740 case RC_FULL_SCREEN_LIMIT:
1741 if (ignore_system_lyxrc ||
1742 full_screen_limit != system_lyxrc.full_screen_limit) {
1743 os << "\\fullscreen_limit "
1744 << convert<string>(full_screen_limit)
1745 << '\n';
1747 if (tag != RC_LAST)
1748 break;
1749 case RC_FULL_SCREEN_TOOLBARS:
1750 if (ignore_system_lyxrc ||
1751 full_screen_toolbars != system_lyxrc.full_screen_toolbars) {
1752 os << "\\fullscreen_toolbars "
1753 << convert<string>(full_screen_toolbars)
1754 << '\n';
1756 if (tag != RC_LAST)
1757 break;
1758 case RC_FULL_SCREEN_SCROLLBAR:
1759 if (ignore_system_lyxrc ||
1760 full_screen_scrollbar != system_lyxrc.full_screen_scrollbar) {
1761 os << "\\fullscreen_scrollbar "
1762 << convert<string>(full_screen_scrollbar)
1763 << '\n';
1765 if (tag != RC_LAST)
1766 break;
1767 case RC_FULL_SCREEN_TABBAR:
1768 if (ignore_system_lyxrc ||
1769 full_screen_tabbar != system_lyxrc.full_screen_tabbar) {
1770 os << "\\fullscreen_tabbar "
1771 << convert<string>(full_screen_tabbar)
1772 << '\n';
1774 if (tag != RC_LAST)
1775 break;
1776 case RC_FULL_SCREEN_MENUBAR:
1777 if (ignore_system_lyxrc ||
1778 full_screen_menubar != system_lyxrc.full_screen_menubar) {
1779 os << "\\fullscreen_menubar "
1780 << convert<string>(full_screen_menubar)
1781 << '\n';
1783 if (tag != RC_LAST)
1784 break;
1785 case RC_FULL_SCREEN_WIDTH:
1786 if (ignore_system_lyxrc ||
1787 full_screen_width != system_lyxrc.full_screen_width) {
1788 os << "\\fullscreen_width "
1789 << convert<string>(full_screen_width)
1790 << '\n';
1792 if (tag != RC_LAST)
1793 break;
1794 case RC_OPEN_BUFFERS_IN_TABS:
1795 if (ignore_system_lyxrc ||
1796 open_buffers_in_tabs != system_lyxrc.open_buffers_in_tabs) {
1797 os << "\\open_buffers_in_tabs "
1798 << convert<string>(open_buffers_in_tabs)
1799 << '\n';
1801 if (tag != RC_LAST)
1802 break;
1804 os << "\n#\n"
1805 << "# COLOR SECTION ###################################\n"
1806 << "#\n\n";
1808 case RC_SET_COLOR:
1809 for (int i = 0; i < Color_ignore; ++i) {
1810 ColorCode lc = static_cast<ColorCode>(i);
1811 string const col = lcolor.getX11Name(lc);
1812 if (ignore_system_lyxrc
1813 || col != system_lcolor.getX11Name(lc)) {
1814 os << "\\set_color \""
1815 << lcolor.getLyXName(lc) << "\" \""
1816 << col << "\"\n";
1819 if (tag != RC_LAST)
1820 break;
1822 os << "\n#\n"
1823 << "# PRINTER SECTION ###################################\n"
1824 << "#\n\n";
1826 case RC_PRINTER:
1827 if (ignore_system_lyxrc ||
1828 printer != system_lyxrc.printer) {
1829 os << "\\printer \"" << printer << "\"\n";
1831 if (tag != RC_LAST)
1832 break;
1833 case RC_PRINT_ADAPTOUTPUT:
1834 if (ignore_system_lyxrc ||
1835 print_adapt_output != system_lyxrc.print_adapt_output) {
1836 os << "\\print_adapt_output "
1837 << convert<string>(print_adapt_output)
1838 << '\n';
1840 if (tag != RC_LAST)
1841 break;
1842 case RC_PRINT_COMMAND:
1843 if (ignore_system_lyxrc ||
1844 print_command != system_lyxrc.print_command) {
1845 os << "\\print_command \"" << escapeCommand(print_command) << "\"\n";
1847 if (tag != RC_LAST)
1848 break;
1849 case RC_PRINTEXSTRAOPTIONS:
1850 if (ignore_system_lyxrc ||
1851 print_extra_options != system_lyxrc.print_extra_options) {
1852 os << "\\print_extra_options \"" << print_extra_options
1853 << "\"\n";
1855 if (tag != RC_LAST)
1856 break;
1857 case RC_PRINTSPOOL_COMMAND:
1858 if (ignore_system_lyxrc ||
1859 print_spool_command != system_lyxrc.print_spool_command) {
1860 os << "\\print_spool_command \"" << escapeCommand(print_spool_command)
1861 << "\"\n";
1863 if (tag != RC_LAST)
1864 break;
1865 case RC_PRINTSPOOL_PRINTERPREFIX:
1866 if (ignore_system_lyxrc ||
1867 print_spool_printerprefix
1868 != system_lyxrc.print_spool_printerprefix) {
1869 os << "\\print_spool_printerprefix \""
1870 << print_spool_printerprefix << "\"\n";
1872 if (tag != RC_LAST)
1873 break;
1874 case RC_PRINTEVENPAGEFLAG:
1875 if (ignore_system_lyxrc ||
1876 print_evenpage_flag != system_lyxrc.print_evenpage_flag) {
1877 os << "\\print_evenpage_flag \"" << print_evenpage_flag
1878 << "\"\n";
1880 if (tag != RC_LAST)
1881 break;
1882 case RC_PRINTODDPAGEFLAG:
1883 if (ignore_system_lyxrc ||
1884 print_oddpage_flag != system_lyxrc.print_oddpage_flag) {
1885 os << "\\print_oddpage_flag \"" << print_oddpage_flag
1886 << "\"\n";
1888 if (tag != RC_LAST)
1889 break;
1890 case RC_PRINTREVERSEFLAG:
1891 if (ignore_system_lyxrc ||
1892 print_reverse_flag != system_lyxrc.print_reverse_flag) {
1893 os << "\\print_reverse_flag \"" << print_reverse_flag
1894 << "\"\n";
1896 if (tag != RC_LAST)
1897 break;
1898 case RC_PRINTLANDSCAPEFLAG:
1899 if (ignore_system_lyxrc ||
1900 print_landscape_flag != system_lyxrc.print_landscape_flag) {
1901 os << "\\print_landscape_flag \"" << print_landscape_flag
1902 << "\"\n";
1904 if (tag != RC_LAST)
1905 break;
1906 case RC_PRINTPAGERANGEFLAG:
1907 if (ignore_system_lyxrc ||
1908 print_pagerange_flag != system_lyxrc.print_pagerange_flag) {
1909 os << "\\print_pagerange_flag \"" << print_pagerange_flag
1910 << "\"\n";
1912 if (tag != RC_LAST)
1913 break;
1914 case RC_PRINTCOPIESFLAG:
1915 if (ignore_system_lyxrc ||
1916 print_copies_flag != system_lyxrc.print_copies_flag) {
1917 os << "\\print_copies_flag \"" << print_copies_flag
1918 << "\"\n";
1920 if (tag != RC_LAST)
1921 break;
1922 case RC_PRINTCOLLCOPIESFLAG:
1923 if (ignore_system_lyxrc ||
1924 print_collcopies_flag
1925 != system_lyxrc.print_collcopies_flag) {
1926 os << "\\print_collcopies_flag \""
1927 << print_collcopies_flag
1928 << "\"\n";
1930 if (tag != RC_LAST)
1931 break;
1932 case RC_PRINTPAPERFLAG:
1933 if (ignore_system_lyxrc ||
1934 print_paper_flag != system_lyxrc.print_paper_flag) {
1935 os << "\\print_paper_flag \"" << print_paper_flag
1936 << "\"\n";
1938 if (tag != RC_LAST)
1939 break;
1940 case RC_PRINTPAPERDIMENSIONFLAG:
1941 if (ignore_system_lyxrc ||
1942 print_paper_dimension_flag
1943 != system_lyxrc.print_paper_dimension_flag) {
1944 os << "\\print_paper_dimension_flag \""
1945 << print_paper_dimension_flag << "\"\n";
1947 if (tag != RC_LAST)
1948 break;
1949 case RC_PRINTTOPRINTER:
1950 if (ignore_system_lyxrc ||
1951 print_to_printer != system_lyxrc.print_to_printer) {
1952 os << "\\print_to_printer \"" << print_to_printer
1953 << "\"\n";
1955 if (tag != RC_LAST)
1956 break;
1957 case RC_PRINTTOFILE:
1958 if (ignore_system_lyxrc ||
1959 print_to_file != system_lyxrc.print_to_file) {
1960 string const path = os::external_path(print_to_file);
1961 os << "\\print_to_file \"" << path << "\"\n";
1963 if (tag != RC_LAST)
1964 break;
1965 case RC_PRINTFILEEXTENSION:
1966 if (ignore_system_lyxrc ||
1967 print_file_extension != system_lyxrc.print_file_extension) {
1968 os << "\\print_file_extension \""
1969 << print_file_extension
1970 << "\"\n";
1972 if (tag != RC_LAST)
1973 break;
1975 os << "\n#\n"
1976 << "# TEX SECTION #######################################\n"
1977 << "#\n\n";
1979 case RC_FONT_ENCODING:
1980 if (ignore_system_lyxrc ||
1981 fontenc != system_lyxrc.fontenc) {
1982 os << "\\font_encoding \"" << fontenc << "\"\n";
1984 if (tag != RC_LAST)
1985 break;
1987 os << "\n#\n"
1988 << "# FILE SECTION ######################################\n"
1989 << "#\n\n";
1991 case RC_DOCUMENTPATH:
1992 if (ignore_system_lyxrc ||
1993 document_path != system_lyxrc.document_path) {
1994 string const path = os::external_path(document_path);
1995 os << "\\document_path \"" << path << "\"\n";
1997 if (tag != RC_LAST)
1998 break;
1999 case RC_USELASTFILEPOS:
2000 if (ignore_system_lyxrc ||
2001 use_lastfilepos != system_lyxrc.use_lastfilepos) {
2002 os << "\\use_lastfilepos " << convert<string>(use_lastfilepos)
2003 << '\n';
2005 if (tag != RC_LAST)
2006 break;
2007 case RC_LOADSESSION:
2008 if (ignore_system_lyxrc ||
2009 load_session != system_lyxrc.load_session) {
2010 os << "\\load_session " << convert<string>(load_session)
2011 << "\n";
2013 if (tag != RC_LAST)
2014 break;
2015 case RC_MOUSE_WHEEL_SPEED:
2016 if (ignore_system_lyxrc ||
2017 mouse_wheel_speed != system_lyxrc.mouse_wheel_speed) {
2018 os << "\\mouse_wheel_speed " << mouse_wheel_speed << '\n';
2020 if (tag != RC_LAST)
2021 break;
2022 case RC_COMPLETION_INLINE_DELAY:
2023 if (ignore_system_lyxrc ||
2024 completion_inline_delay != system_lyxrc.completion_inline_delay) {
2025 os << "\\completion_inline_delay " << completion_inline_delay << '\n';
2027 if (tag != RC_LAST)
2028 break;
2029 case RC_COMPLETION_INLINE_MATH:
2030 if (ignore_system_lyxrc ||
2031 completion_inline_math != system_lyxrc.completion_inline_math) {
2032 os << "\\completion_inline_math "
2033 << convert<string>(completion_inline_math) << '\n';
2035 if (tag != RC_LAST)
2036 break;
2037 case RC_COMPLETION_INLINE_TEXT:
2038 if (ignore_system_lyxrc ||
2039 completion_inline_text != system_lyxrc.completion_inline_text) {
2040 os << "\\completion_inline_text "
2041 << convert<string>(completion_inline_text) << '\n';
2043 if (tag != RC_LAST)
2044 break;
2045 case RC_COMPLETION_INLINE_DOTS:
2046 if (ignore_system_lyxrc ||
2047 completion_inline_dots != system_lyxrc.completion_inline_dots) {
2048 os << "\\completion_inline_dots "
2049 << convert<string>(completion_inline_dots) << '\n';
2051 if (tag != RC_LAST)
2052 break;
2053 case RC_AUTOCORRECTION_MATH:
2054 if (ignore_system_lyxrc ||
2055 autocorrection_math != system_lyxrc.autocorrection_math) {
2056 os << "\\autocorrection_math "
2057 << convert<string>(autocorrection_math) << '\n';
2059 if (tag != RC_LAST)
2060 break;
2061 case RC_COMPLETION_POPUP_DELAY:
2062 if (ignore_system_lyxrc ||
2063 completion_popup_delay != system_lyxrc.completion_popup_delay) {
2064 os << "\\completion_popup_delay " << completion_popup_delay << '\n';
2066 if (tag != RC_LAST)
2067 break;
2068 case RC_COMPLETION_POPUP_MATH:
2069 if (ignore_system_lyxrc ||
2070 completion_popup_math != system_lyxrc.completion_popup_math) {
2071 os << "\\completion_popup_math "
2072 << convert<string>(completion_popup_math) << '\n';
2074 if (tag != RC_LAST)
2075 break;
2076 case RC_COMPLETION_POPUP_TEXT:
2077 if (ignore_system_lyxrc ||
2078 completion_popup_text != system_lyxrc.completion_popup_text) {
2079 os << "\\completion_popup_text "
2080 << convert<string>(completion_popup_text) << '\n';
2082 if (tag != RC_LAST)
2083 break;
2084 case RC_COMPLETION_CURSOR_TEXT:
2085 if (ignore_system_lyxrc ||
2086 completion_cursor_text != system_lyxrc.completion_cursor_text) {
2087 os << "\\completion_cursor_text "
2088 << convert<string>(completion_cursor_text) << '\n';
2090 if (tag != RC_LAST)
2091 break;
2092 case RC_COMPLETION_POPUP_AFTER_COMPLETE:
2093 if (ignore_system_lyxrc ||
2094 completion_popup_after_complete
2095 != system_lyxrc.completion_popup_after_complete) {
2096 os << "\\completion_popup_after_complete "
2097 << convert<string>(completion_popup_after_complete) << '\n';
2099 if (tag != RC_LAST)
2100 break;
2101 case RC_NUMLASTFILES:
2102 if (ignore_system_lyxrc ||
2103 num_lastfiles != system_lyxrc.num_lastfiles) {
2104 os << "\\num_lastfiles " << num_lastfiles << '\n';
2106 if (tag != RC_LAST)
2107 break;
2108 case RC_CHECKLASTFILES:
2109 if (ignore_system_lyxrc ||
2110 check_lastfiles != system_lyxrc.check_lastfiles) {
2111 os << "\\check_lastfiles " << convert<string>(check_lastfiles)
2112 << '\n';
2114 if (tag != RC_LAST)
2115 break;
2116 case RC_EXAMPLEPATH:
2117 if (ignore_system_lyxrc ||
2118 example_path != system_lyxrc.example_path) {
2119 string const path = os::external_path(example_path);
2120 os << "\\example_path \"" << path << "\"\n";
2122 if (tag != RC_LAST)
2123 break;
2124 case RC_TEMPLATEPATH:
2125 if (ignore_system_lyxrc ||
2126 template_path != system_lyxrc.template_path) {
2127 string const path = os::external_path(template_path);
2128 os << "\\template_path \"" << path << "\"\n";
2130 if (tag != RC_LAST)
2131 break;
2132 case RC_TEMPDIRPATH:
2133 if (ignore_system_lyxrc ||
2134 tempdir_path != system_lyxrc.tempdir_path) {
2135 string const path = os::external_path(tempdir_path);
2136 os << "\\tempdir_path \"" << path << "\"\n";
2138 if (tag != RC_LAST)
2139 break;
2140 case RC_THESAURUSDIRPATH:
2141 if (ignore_system_lyxrc ||
2142 thesaurusdir_path != system_lyxrc.thesaurusdir_path) {
2143 string const path = os::external_path(thesaurusdir_path);
2144 os << "\\thesaurusdir_path \"" << path << "\"\n";
2146 if (tag != RC_LAST)
2147 break;
2148 case RC_HUNSPELLDIR_PATH:
2149 if (ignore_system_lyxrc ||
2150 hunspelldir_path != system_lyxrc.hunspelldir_path) {
2151 string const path = os::external_path(hunspelldir_path);
2152 os << "\\hunspelldir_path \"" << path << "\"\n";
2154 if (tag != RC_LAST)
2155 break;
2156 case RC_USETEMPDIR:
2157 if (tag != RC_LAST)
2158 break;
2159 // Ignore it
2160 case RC_PLAINTEXT_ROFF_COMMAND: // Obsoleted in 2.0
2161 if (tag != RC_LAST)
2162 break;
2163 case RC_PLAINTEXT_LINELEN:
2164 if (ignore_system_lyxrc ||
2165 plaintext_linelen != system_lyxrc.plaintext_linelen) {
2166 os << "\\plaintext_linelen " << plaintext_linelen << '\n';
2168 if (tag != RC_LAST)
2169 break;
2170 case RC_MAKE_BACKUP:
2171 if (ignore_system_lyxrc ||
2172 make_backup != system_lyxrc.make_backup) {
2173 os << "\\make_backup " << convert<string>(make_backup) << '\n';
2175 if (tag != RC_LAST)
2176 break;
2177 case RC_BACKUPDIR_PATH:
2178 if (ignore_system_lyxrc ||
2179 backupdir_path != system_lyxrc.backupdir_path) {
2180 string const path = os::external_path(backupdir_path);
2181 os << "\\backupdir_path \"" << path << "\"\n";
2183 if (tag != RC_LAST)
2184 break;
2186 os << "\n#\n"
2187 << "# PLAIN TEXT EXPORT SECTION ##############################\n"
2188 << "#\n\n";
2190 os << "\n#\n"
2191 << "# SPELLCHECKER SECTION ##############################\n"
2192 << "#\n\n";
2194 case RC_SPELL_COMMAND:
2195 case RC_USE_SPELL_LIB:
2196 // Obsoleted in 2.0
2197 if (tag != RC_LAST)
2198 break;
2199 case RC_ACCEPT_COMPOUND:
2200 if (ignore_system_lyxrc ||
2201 spellchecker_accept_compound != system_lyxrc.spellchecker_accept_compound) {
2202 os << "\\accept_compound " << convert<string>(spellchecker_accept_compound)
2203 << '\n';
2205 if (tag != RC_LAST)
2206 break;
2207 case RC_USE_ALT_LANG:
2208 // Obsoleted in 2.0
2209 if (tag != RC_LAST)
2210 break;
2211 case RC_ALT_LANG:
2212 if (ignore_system_lyxrc ||
2213 spellchecker_alt_lang != system_lyxrc.spellchecker_alt_lang) {
2214 os << "\\alternate_language \"" << spellchecker_alt_lang
2215 << "\"\n";
2217 if (tag != RC_LAST)
2218 break;
2219 case RC_USE_ESC_CHARS:
2220 if (tag != RC_LAST)
2221 break;
2222 case RC_ESC_CHARS:
2223 if (ignore_system_lyxrc ||
2224 spellchecker_esc_chars != system_lyxrc.spellchecker_esc_chars) {
2225 os << "\\escape_chars \"" << spellchecker_esc_chars << "\"\n";
2227 if (tag != RC_LAST)
2228 break;
2229 case RC_USE_PERS_DICT:
2230 // obsoleted in 2.0
2231 if (tag != RC_LAST)
2232 break;
2233 case RC_USE_TOOLTIP:
2234 if (ignore_system_lyxrc ||
2235 use_tooltip != system_lyxrc.use_tooltip) {
2236 os << "\\use_tooltip "
2237 << convert<string>(use_tooltip)
2238 << '\n';
2240 if (tag != RC_LAST)
2241 break;
2242 case RC_USE_PIXMAP_CACHE:
2243 if (ignore_system_lyxrc ||
2244 use_pixmap_cache != system_lyxrc.use_pixmap_cache) {
2245 os << "\\use_pixmap_cache "
2246 << convert<string>(use_pixmap_cache)
2247 << '\n';
2249 if (tag != RC_LAST)
2250 break;
2251 case RC_PERS_DICT:
2252 // obsoleted in 2.0
2253 if (tag != RC_LAST)
2254 break;
2255 case RC_USE_INP_ENC:
2256 // obsoleted in 2.0
2257 if (tag != RC_LAST)
2258 break;
2260 os << "\n#\n"
2261 << "# LANGUAGE SUPPORT SECTION ##########################\n"
2262 << "#\n\n";
2263 if (tag != RC_LAST)
2264 break;
2266 case RC_SPELLCHECKER:
2267 if (ignore_system_lyxrc ||
2268 spellchecker != system_lyxrc.spellchecker) {
2269 os << "\\spellchecker " << spellchecker << '\n';
2271 if (tag != RC_LAST)
2272 break;
2274 case RC_SPELLCHECK_CONTINUOUSLY:
2275 if (ignore_system_lyxrc ||
2276 spellcheck_continuously != system_lyxrc.spellcheck_continuously) {
2277 os << "\\spellcheck_continuously " << convert<string>(spellcheck_continuously)
2278 << '\n';
2280 if (tag != RC_LAST)
2281 break;
2283 case RC_RTL_SUPPORT:
2284 if (ignore_system_lyxrc ||
2285 rtl_support != system_lyxrc.rtl_support) {
2286 os << "\\rtl " << convert<string>(rtl_support) << '\n';
2288 if (tag != RC_LAST)
2289 break;
2290 case RC_VISUAL_CURSOR:
2291 if (ignore_system_lyxrc ||
2292 visual_cursor != system_lyxrc.visual_cursor) {
2293 os << "\\visual_cursor " << convert<string>(visual_cursor) << '\n';
2295 if (tag != RC_LAST)
2296 break;
2297 case RC_LANGUAGE_PACKAGE:
2298 if (ignore_system_lyxrc ||
2299 language_package != system_lyxrc.language_package) {
2300 os << "\\language_package \"" << language_package
2301 << "\"\n";
2303 if (tag != RC_LAST)
2304 break;
2305 case RC_LANGUAGE_GLOBAL_OPTIONS:
2306 if (ignore_system_lyxrc ||
2307 language_global_options
2308 != system_lyxrc.language_global_options) {
2309 os << "\\language_global_options \""
2310 << convert<string>(language_global_options)
2311 << "\"\n";
2313 if (tag != RC_LAST)
2314 break;
2315 case RC_LANGUAGE_USE_BABEL:
2316 if (ignore_system_lyxrc ||
2317 language_use_babel != system_lyxrc.language_use_babel) {
2318 os << "\\language_use_babel \""
2319 << convert<string>(language_use_babel)
2320 << "\"\n";
2322 if (tag != RC_LAST)
2323 break;
2324 case RC_LANGUAGE_COMMAND_BEGIN:
2325 if (ignore_system_lyxrc ||
2326 language_command_begin
2327 != system_lyxrc.language_command_begin) {
2328 os << "\\language_command_begin \""
2329 << language_command_begin
2330 << "\"\n";
2332 if (tag != RC_LAST)
2333 break;
2334 case RC_LANGUAGE_COMMAND_END:
2335 if (ignore_system_lyxrc ||
2336 language_command_end
2337 != system_lyxrc.language_command_end) {
2338 os << "\\language_command_end \"" << language_command_end
2339 << "\"\n";
2341 if (tag != RC_LAST)
2342 break;
2343 case RC_LANGUAGE_COMMAND_LOCAL:
2344 if (ignore_system_lyxrc ||
2345 language_command_local
2346 != system_lyxrc.language_command_local) {
2347 os << "\\language_command_local \""
2348 << language_command_local
2349 << "\"\n";
2351 if (tag != RC_LAST)
2352 break;
2353 case RC_LANGUAGE_AUTO_BEGIN:
2354 if (ignore_system_lyxrc ||
2355 language_auto_begin != system_lyxrc.language_auto_begin) {
2356 os << "\\language_auto_begin "
2357 << convert<string>(language_auto_begin) << '\n';
2359 if (tag != RC_LAST)
2360 break;
2361 case RC_LANGUAGE_AUTO_END:
2362 if (ignore_system_lyxrc ||
2363 language_auto_end != system_lyxrc.language_auto_end) {
2364 os << "\\language_auto_end "
2365 << convert<string>(language_auto_end) << '\n';
2367 if (tag != RC_LAST)
2368 break;
2369 case RC_MARK_FOREIGN_LANGUAGE:
2370 if (ignore_system_lyxrc ||
2371 mark_foreign_language
2372 != system_lyxrc.mark_foreign_language) {
2373 os << "\\mark_foreign_language " <<
2374 convert<string>(mark_foreign_language) << '\n';
2376 if (tag != RC_LAST)
2377 break;
2379 os << "\n#\n"
2380 << "# 2nd MISC SUPPORT SECTION ##########################\n"
2381 << "#\n\n";
2383 case RC_AUTO_NUMBER:
2384 if (ignore_system_lyxrc ||
2385 auto_number != system_lyxrc.auto_number) {
2386 os << "\\auto_number " << convert<string>(auto_number) << '\n';
2388 if (tag != RC_LAST)
2389 break;
2390 case RC_DEFAULT_LANGUAGE:
2391 if (ignore_system_lyxrc ||
2392 default_language != system_lyxrc.default_language) {
2393 os << "\\default_language " << default_language << '\n';
2395 if (tag != RC_LAST)
2396 break;
2397 case RC_GUI_LANGUAGE:
2398 if (ignore_system_lyxrc ||
2399 gui_language != system_lyxrc.gui_language) {
2400 os << "\\gui_language " << gui_language << '\n';
2402 if (tag != RC_LAST)
2403 break;
2405 os << "\n#\n"
2406 << "# FORMATS SECTION ##########################\n"
2407 << "#\n\n";
2409 case RC_FORMAT:
2410 // New/modified formats
2411 for (Formats::const_iterator cit = formats.begin();
2412 cit != formats.end(); ++cit) {
2413 Format const * format =
2414 system_formats.getFormat(cit->name());
2415 if (!format ||
2416 format->extension() != cit->extension() ||
2417 format->prettyname() != cit->prettyname() ||
2418 format->shortcut() != cit->shortcut() ||
2419 format->viewer() != cit->viewer() ||
2420 format->editor() != cit->editor() ||
2421 format->documentFormat() != cit->documentFormat() ||
2422 format->vectorFormat() != cit->vectorFormat()) {
2423 os << "\\format \"" << cit->name() << "\" \""
2424 << cit->extension() << "\" \""
2425 << cit->prettyname() << "\" \""
2426 << cit->shortcut() << "\" \""
2427 << escapeCommand(cit->viewer()) << "\" \""
2428 << escapeCommand(cit->editor()) << "\" \"";
2429 vector<string> flags;
2430 if (cit->documentFormat())
2431 flags.push_back("document");
2432 if (cit->vectorFormat())
2433 flags.push_back("vector");
2434 os << getStringFromVector(flags);
2435 os << "\"\n";
2439 // Look for deleted formats
2440 for (Formats::const_iterator cit = system_formats.begin();
2441 cit != system_formats.end(); ++cit)
2442 if (!formats.getFormat(cit->name()))
2443 os << "\\format \"" << cit->name()
2444 << "\" \"\" \"\" \"\" \"\" \"\" \"\"\n";
2445 if (tag != RC_LAST)
2446 break;
2447 case RC_DEFAULT_VIEW_FORMAT:
2448 if (ignore_system_lyxrc ||
2449 default_view_format != system_lyxrc.default_view_format) {
2450 os << "\\default_view_format " << default_view_format << '\n';
2452 if (tag != RC_LAST)
2453 break;
2454 case RC_VIEWER:
2455 // Ignore it
2456 if (tag != RC_LAST)
2457 break;
2459 os << "\n#\n"
2460 << "# CONVERTERS SECTION ##########################\n"
2461 << "#\n\n";
2463 case RC_CONVERTER:
2464 // Look for new converters
2465 for (Converters::const_iterator cit = theConverters().begin();
2466 cit != theConverters().end(); ++cit) {
2467 Converter const * converter =
2468 theSystemConverters().getConverter(cit->from,
2469 cit->to);
2470 if (!converter ||
2471 converter->command != cit->command ||
2472 converter->flags != cit->flags)
2473 os << "\\converter \"" << cit->from << "\" \""
2474 << cit->to << "\" \""
2475 << escapeCommand(cit->command) << "\" \""
2476 << cit->flags << "\"\n";
2479 // New/modifed converters
2480 for (Converters::const_iterator cit = theSystemConverters().begin();
2481 cit != theSystemConverters().end(); ++cit)
2482 if (!theConverters().getConverter(cit->from, cit->to))
2483 os << "\\converter \"" << cit->from
2484 << "\" \"" << cit->to << "\" \"\" \"\"\n";
2485 if (tag != RC_LAST)
2486 break;
2488 case RC_COPIER:
2489 if (tag == RC_LAST)
2490 os << "\n#\n"
2491 << "# COPIERS SECTION ##########################\n"
2492 << "#\n\n";
2494 // Look for new movers
2495 Movers::const_iterator const sysbegin = theSystemMovers().begin();
2496 Movers::const_iterator const sysend = theSystemMovers().end();
2497 Movers::const_iterator it = theMovers().begin();
2498 Movers::const_iterator end = theMovers().end();
2500 for (; it != end; ++it) {
2501 Movers::const_iterator const sysit =
2502 find_if(sysbegin, sysend, SameMover(*it));
2503 if (sysit == sysend) {
2504 string const & fmt = it->first;
2505 string const & command =
2506 it->second.command();
2508 os << "\\copier " << fmt
2509 << " \"" << escapeCommand(command) << "\"\n";
2512 if (tag != RC_LAST)
2513 break;
2515 // We don't actually delete SpecialisedMover(s) from the
2516 // map, just clear their 'command', so there's no need
2517 // to test for anything else.
2520 os.flush();
2524 #if 0
2525 string const LyXRC::getDescription(LyXRCTags tag)
2527 docstring str;
2529 switch (tag) {
2530 case RC_ACCEPT_COMPOUND:
2531 str = _("Consider run-together words, such as \"diskdrive\" for \"disk drive\", as legal words?");
2532 break;
2534 case RC_ALT_LANG:
2535 case RC_USE_ALT_LANG:
2536 str = _("Specify an alternate language. The default is to use the language of the document.");
2537 break;
2539 case RC_PLAINTEXT_ROFF_COMMAND:
2540 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.");
2541 break;
2543 case RC_PLAINTEXT_LINELEN:
2544 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.");
2545 break;
2547 case RC_AUTOREGIONDELETE:
2548 str = _("De-select if you don't want the current selection to be replaced automatically by what you type.");
2549 break;
2551 case RC_AUTORESET_OPTIONS:
2552 str = _("De-select if you don't want the class options to be reset to defaults after class change.");
2553 break;
2555 case RC_AUTOSAVE:
2556 str = _("The time interval between auto-saves (in seconds). 0 means no auto-save.");
2557 break;
2559 case RC_AUTO_NUMBER:
2560 break;
2562 case RC_BACKUPDIR_PATH:
2563 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.");
2564 break;
2566 case RC_BIBTEX_COMMAND:
2567 str = _("Define the options of bibtex (cf. man bibtex) or select an alternative compiler (e.g. mlbibtex or bibulus).");
2568 break;
2570 case RC_JBIBTEX_COMMAND:
2571 str = _("Define the options of the bibtex program for PLaTeX (Japanese LaTeX).");
2572 break;
2574 case RC_BINDFILE:
2575 str = _("Keybindings file. Can either specify an absolute path, or LyX will look in its global and local bind/ directories.");
2576 break;
2578 case RC_CHECKLASTFILES:
2579 str = _("Select to check whether the lastfiles still exist.");
2580 break;
2582 case RC_CHKTEX_COMMAND:
2583 str = _("Define how to run chktex. E.g. \"chktex -n11 -n1 -n3 -n6 -n9 -22 -n25 -n30 -n38\" Refer to the ChkTeX documentation.");
2584 break;
2586 case RC_CONVERTER:
2587 break;
2589 case RC_COPIER:
2590 break;
2592 case RC_CURSOR_FOLLOWS_SCROLLBAR:
2593 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.");
2594 break;
2596 case RC_SCROLL_BELOW_DOCUMENT:
2597 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");
2598 break;
2600 case RC_MAC_LIKE_WORD_MOVEMENT:
2601 str = _("Use the Mac OS X conventions for the word-level cursor movement");
2602 break;
2604 case RC_SHOW_MACRO_LABEL:
2605 str = _("Show a small box around a Math Macro with the macro name when the cursor is inside.");
2606 break;
2608 case RC_DATE_INSERT_FORMAT:
2609 //xgettext:no-c-format
2610 str = _("This accepts the normal strftime formats; see man strftime for full details. E.g.\"%A, %e. %B %Y\".");
2611 break;
2613 case RC_DEFFILE:
2614 str = _("Command definition file. Can either specify an absolute path, or LyX will look in its global and local commands/ directories.");
2615 break;
2617 case RC_DEFAULT_VIEW_FORMAT:
2618 str = _("The default format used with LFUN_BUFFER_[VIEW|UPDATE].");
2619 break;
2621 case RC_DEFAULT_LANGUAGE:
2622 str = _("New documents will be assigned this language.");
2623 break;
2625 case RC_DEFAULT_PAPERSIZE:
2626 str = _("Specify the default paper size.");
2627 break;
2629 case RC_DIALOGS_ICONIFY_WITH_MAIN:
2630 str = _("Iconify the dialogs when the main window is iconified. (Affects only dialogs shown after the change has been made.)");
2631 break;
2633 case RC_DISPLAY_GRAPHICS:
2634 str = _("Select how LyX will display any graphics.");
2635 break;
2637 case RC_DOCUMENTPATH:
2638 str = _("The default path for your documents. An empty value selects the directory LyX was started from.");
2639 break;
2641 case RC_ESC_CHARS:
2642 case RC_USE_ESC_CHARS:
2643 str = _("Specify additional chars that can be part of a word.");
2644 break;
2646 case RC_EXAMPLEPATH:
2647 str = _("The path that LyX will set when offering to choose an example. An empty value selects the directory LyX was started from.");
2648 break;
2650 case RC_FONT_ENCODING:
2651 str = _("The font encoding used for the LaTeX2e fontenc package. T1 is highly recommended for non-English languages.");
2652 break;
2654 case RC_FORMAT:
2655 break;
2657 case RC_INDEX_COMMAND:
2658 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\".");
2659 break;
2661 case RC_JINDEX_COMMAND:
2662 str = _("Define the options of the index program for PLaTeX (Japanese LaTeX).");
2663 break;
2665 case RC_NOMENCL_COMMAND:
2666 str = _("Define the options of makeindex (cf. man makeindex) to be used for nomenclatures. This might differ from the index processing options.");
2667 break;
2669 case RC_INPUT:
2670 break;
2672 case RC_KBMAP:
2673 case RC_KBMAP_PRIMARY:
2674 case RC_KBMAP_SECONDARY:
2675 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.");
2676 break;
2678 case RC_LABEL_INIT_LENGTH:
2679 str = _("Maximum number of words in the initialization string for a new label");
2680 break;
2682 case RC_LANGUAGE_AUTO_BEGIN:
2683 str = _("Select if a language switching command is needed at the beginning of the document.");
2684 break;
2686 case RC_LANGUAGE_AUTO_END:
2687 str = _("Select if a language switching command is needed at the end of the document.");
2688 break;
2690 case RC_LANGUAGE_COMMAND_BEGIN:
2691 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.");
2692 break;
2694 case RC_LANGUAGE_COMMAND_END:
2695 str = _("The LaTeX command for changing back to the language of the document.");
2696 break;
2698 case RC_LANGUAGE_COMMAND_LOCAL:
2699 str = _("The LaTeX command for local changing of the language.");
2700 break;
2702 case RC_LANGUAGE_GLOBAL_OPTIONS:
2703 str = _("De-select if you don't want the language(s) used as an argument to \\documentclass.");
2704 break;
2706 case RC_LANGUAGE_PACKAGE:
2707 str = _("The LaTeX command for loading the language package. E.g. \"\\usepackage{babel}\", \"\\usepackage{omega}\".");
2708 break;
2710 case RC_LANGUAGE_USE_BABEL:
2711 str = _("De-select if you don't want babel to be used when the language of the document is the default language.");
2712 break;
2714 case RC_USELASTFILEPOS:
2715 str = _("De-select if you do not want LyX to scroll to saved position.");
2716 break;
2718 case RC_LOADSESSION:
2719 str = _("De-select to prevent loading files opened from the last LyX session.");
2720 break;
2722 case RC_MAKE_BACKUP:
2723 str = _("De-select if you don't want LyX to create backup files.");
2724 break;
2726 case RC_MARK_FOREIGN_LANGUAGE:
2727 str = _("Select to control the highlighting of words with a language foreign to that of the document.");
2728 break;
2730 case RC_MOUSE_WHEEL_SPEED:
2731 str = bformat(_("The scrolling speed of the mouse wheel."),
2732 maxlastfiles);
2733 break;
2735 case RC_COMPLETION_POPUP_DELAY:
2736 str = _("The completion popup delay.");
2737 break;
2739 case RC_COMPLETION_POPUP_MATH:
2740 str = _("Select to display the completion popup in math mode.");
2741 break;
2743 case RC_COMPLETION_POPUP_TEXT:
2744 str = _("Select to display the completion popup in text mode.");
2745 break;
2747 case RC_COMPLETION_POPUP_AFTER_COMPLETE:
2748 str = _("Show the completion popup without delay after non-unique completion attempt.");
2749 break;
2751 case RC_COMPLETION_POPUP_TEXT:
2752 str = _("Show a small triangle on the cursor to indicate that a completion is available.");
2753 break;
2755 case RC_COMPLETION_POPUP_DELAY:
2756 str = _("The inline completion delay.");
2757 break;
2759 case RC_COMPLETION_INLINE_MATH:
2760 str = _("Select to display the inline completion in math mode.");
2761 break;
2763 case RC_COMPLETION_INLINE_TEXT:
2764 str = _("Select to display the inline completion in text mode.");
2765 break;
2767 case RC_COMPLETION_INLINE_DOTS:
2768 str = _("Use \"...\" to shorten long completions.");
2769 break;
2771 case RC_AUTOCORRECTION_MATH:
2772 str = _("Allow TeXMacs shorthand, like => converting to \Rightarrow.");
2773 break;
2775 case RC_NUMLASTFILES:
2776 str = bformat(_("Maximal number of lastfiles. Up to %1$d can appear in the file menu."),
2777 maxlastfiles);
2778 break;
2780 case RC_PATH_PREFIX:
2781 str = _("Specify those directories which should be "
2782 "prepended to the PATH environment variable. "
2783 "Use the OS native format.");
2784 break;
2786 case RC_PREVIEW:
2787 str = _("Shows a typeset preview of things such as math");
2788 break;
2790 case RC_PREVIEW_HASHED_LABELS:
2791 str = _("Previewed equations will have \"(#)\" labels rather than numbered ones");
2792 break;
2794 case RC_PREVIEW_SCALE_FACTOR:
2795 str = _("Scale the preview size to suit.");
2796 break;
2798 case RC_PRINTCOLLCOPIESFLAG:
2799 str = _("The option for specifying whether the copies should be collated.");
2800 break;
2802 case RC_PRINTCOPIESFLAG:
2803 str = _("The option for specifying the number of copies to print.");
2804 break;
2806 case RC_PRINTER:
2807 str = _("The default printer to print on. If none is specified, LyX will use the environment variable PRINTER.");
2808 break;
2810 case RC_PRINTEVENPAGEFLAG:
2811 str = _("The option to print only even pages.");
2812 break;
2814 case RC_PRINTEXSTRAOPTIONS:
2815 str = _("Extra options to pass to printing program after everything else, but before the filename of the DVI file to be printed.");
2816 break;
2818 case RC_PRINTFILEEXTENSION:
2819 str = _("Extension of printer program output file. Usually \".ps\".");
2820 break;
2822 case RC_PRINTLANDSCAPEFLAG:
2823 str = _("The option to print out in landscape.");
2824 break;
2826 case RC_PRINTODDPAGEFLAG:
2827 str = _("The option to print only odd pages.");
2828 break;
2830 case RC_PRINTPAGERANGEFLAG:
2831 str = _("The option for specifying a comma-separated list of pages to print.");
2832 break;
2834 case RC_PRINTPAPERDIMENSIONFLAG:
2835 str = _("Option to specify the dimensions of the print paper.");
2836 break;
2838 case RC_PRINTPAPERFLAG:
2839 str = _("The option to specify paper type.");
2840 break;
2842 case RC_PRINTREVERSEFLAG:
2843 str = _("The option to reverse the order of the pages printed.");
2844 break;
2846 case RC_PRINTSPOOL_COMMAND:
2847 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.");
2848 break;
2850 case RC_PRINTSPOOL_PRINTERPREFIX:
2851 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.");
2852 break;
2854 case RC_PRINTTOFILE:
2855 str = _("Option to pass to the print program to print to a file.");
2856 break;
2858 case RC_PRINTTOPRINTER:
2859 str = _("Option to pass to the print program to print on a specific printer.");
2860 break;
2862 case RC_PRINT_ADAPTOUTPUT:
2863 str = _("Select for LyX to pass the name of the destination printer to your print command.");
2864 break;
2866 case RC_PRINT_COMMAND:
2867 str = _("Your favorite print program, e.g. \"dvips\", \"dvilj4\".");
2868 break;
2870 case RC_RTL_SUPPORT:
2871 str = _("Select to enable support of right-to-left languages (e.g. Hebrew, Arabic).");
2872 break;
2874 case RC_VISUAL_CURSOR:
2875 str = _("Select to have visual bidi cursor movement, unselect for logical movement.");
2876 break;
2878 case RC_SCREEN_DPI:
2879 str = _("DPI (dots per inch) of your monitor is auto-detected by LyX. If that goes wrong, override the setting here.");
2880 break;
2882 case RC_SCREEN_FONT_ROMAN:
2883 case RC_SCREEN_FONT_SANS:
2884 case RC_SCREEN_FONT_TYPEWRITER:
2885 str = _("The screen fonts used to display the text while editing.");
2886 break;
2888 case RC_SCREEN_FONT_ROMAN_FOUNDRY:
2889 case RC_SCREEN_FONT_SANS_FOUNDRY:
2890 case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
2891 break;
2893 case RC_SCREEN_FONT_SCALABLE:
2894 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.");
2895 break;
2897 case RC_SCREEN_FONT_SIZES:
2898 str = _("The font sizes used for calculating the scaling of the screen fonts.");
2899 break;
2901 case RC_SCREEN_ZOOM:
2902 //xgettext:no-c-format
2903 str = _("The zoom percentage for screen fonts. A setting of 100% will make the fonts roughly the same size as on paper.");
2904 break;
2906 case RC_GEOMETRY_SESSION:
2907 str = _("Allow session manager to save and restore windows geometry.");
2908 break;
2910 case RC_SERVERPIPE:
2911 str = _("This starts the lyxserver. The pipes get an additional extension \".in\" and \".out\". Only for advanced users.");
2912 break;
2914 case RC_SET_COLOR:
2915 break;
2917 case RC_SHOW_BANNER:
2918 str = _("De-select if you don't want the startup banner.");
2919 break;
2921 case RC_TEMPDIRPATH:
2922 str = _("LyX will place its temporary directories in this path. They will be deleted when you quit LyX.");
2923 break;
2925 case RC_THESAURUSDIRPATH:
2926 str = _("This is the place where the files of the thesaurus library reside.");
2927 break;
2929 case RC_TEMPLATEPATH:
2930 str = _("The path that LyX will set when offering to choose a template. An empty value selects the directory LyX was started from.");
2931 break;
2933 case RC_TEX_ALLOWS_SPACES:
2934 break;
2936 case RC_TEX_EXPECTS_WINDOWS_PATHS:
2937 break;
2939 case RC_UIFILE:
2940 str = _("The UI (user interface) file. Can either specify an absolute path, or LyX will look in its global and local ui/ directories.");
2941 break;
2943 case RC_USER_EMAIL:
2944 break;
2946 case RC_USER_NAME:
2947 break;
2949 case RC_USETEMPDIR:
2950 break;
2952 case RC_USE_TOOLTIP:
2953 str = _("Enable the automatic appearance of tool tips in the work area.");
2954 break;
2956 case RC_USE_PIXMAP_CACHE:
2957 str = _("Enable the pixmap cache that might improve performance on Mac and Windows.");
2958 break;
2960 case RC_USE_SPELL_LIB:
2961 break;
2963 case RC_VIEWDVI_PAPEROPTION:
2964 _("Specify the paper command to DVI viewer (leave empty or use \"-paper\")");
2965 break;
2967 case RC_VIEWER:
2968 break;
2970 case RC_LAST:
2971 break;
2974 return str;
2976 #endif
2979 // The global instance
2980 LyXRC lyxrc;
2982 // The global copy of the system lyxrc entries (everything except preferences)
2983 LyXRC system_lyxrc;
2986 } // namespace lyx